Skip to content

Commit 4e6ea21

Browse files
committed
v0.4.0
- Improved dependency usage - Removed configuration options - Removed most subcommands
1 parent 1e37427 commit 4e6ea21

56 files changed

Lines changed: 908 additions & 9481 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
File renamed without changes.

Cargo.lock

Lines changed: 637 additions & 6231 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 14 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,24 @@
1-
[package]
2-
name = "devmode"
3-
description = "A project management utility for developers"
4-
version = "0.3.0"
5-
edition.workspace = true
6-
authors.workspace = true
7-
license.workspace = true
8-
repository.workspace = true
9-
homepage.workspace = true
10-
categories.workspace = true
11-
keywords.workspace = true
12-
13-
[dependencies]
14-
libset = "=0.1.2"
15-
clap = { version = "3.2.14", features = ["derive"] }
16-
requestty = "0.4.1"
17-
colored = "2.0.0"
18-
regex = "1.5.4"
19-
git2 = "0.14.4"
20-
git2_credentials = "0.8.0"
21-
cmd_lib = "1.1.0"
22-
walkdir = "2.3.2"
23-
serde = { version = "1.0.126", features = ["derive"] }
24-
fs_extra = "1.2.0"
25-
derive_setters = "0.1.6"
26-
git-url-parse = "0.4.4"
27-
thiserror = "1.0.64"
28-
log = "0.4.22"
29-
301
[workspace.package]
31-
version = "0.1.0"
2+
version = "0.4.1"
323
authors = ["Eduardo Flores <edfloreshz@proton.me>"]
4+
description = "Devmode is a project management utility for developers."
335
edition = "2021"
34-
license = "MIT"
6+
license = "GPL-3.0-only"
357
repository = "https://github.com/edfloreshz/devmode/"
368
homepage = "https://devmode.edfloreshz.dev/"
379
categories = ["development-tools"]
3810
keywords = ["development", "utility"]
39-
exclude = [".idea", ".github", ".vscode"]
11+
exclude = [".idea", ".github", ".vscode", "assets"]
12+
readme = "README.md"
4013

4114
[workspace]
4215
resolver = "2"
43-
members = ["src/cli", "src/ui"]
16+
members = ["cli"]
17+
18+
[workspace.dependencies]
19+
git2 = "0.19.0"
20+
git2_credentials = "0.14.0"
21+
git-url-parse = "0.4.4"
22+
thiserror = "2.0.9"
23+
log = "0.4.22"
24+
dirs = "5.0.1"

src/ui/LICENSE renamed to LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,4 +671,4 @@ into proprietary programs. If your program is a subroutine library, you
671671
may consider it more useful to permit linking proprietary applications with
672672
the library. If this is what you want to do, use the GNU Lesser General
673673
Public License instead of this License. But first, please read
674-
<https://www.gnu.org/licenses/why-not-lgpl.html>.
674+
<https://www.gnu.org/licenses/why-not-lgpl.html>.

README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<div align="center">
2+
<img width=200 src="https://github.com/edfloreshz/devmode/blob/main/assets/img/devmode.png?raw=true"/>
3+
<h1>Dev(mode)</h1>
4+
<a href="https://crates.io/crates/devmode">
5+
<img src="https://img.shields.io/crates/v/devmode?label=Devmode" alt="crate"/>
6+
</a>
7+
<a href="https://crates.io/crates/devmode">
8+
<img src="https://img.shields.io/crates/d/devmode" alt="downloads"/>
9+
</a>
10+
<a href="https://aur.archlinux.org/packages/devmode-git/">
11+
<img src="https://img.shields.io/aur/version/devmode-git" alt="devmode-git"/>
12+
</a>
13+
</div>
14+
15+
**Devmode** is a project management utility for developers.
16+
17+
```
18+
Usage: dm <COMMAND>
19+
20+
Commands:
21+
cl Clones a repository in a specific folder structure.
22+
help Print this message or the help of the given subcommand(s)
23+
24+
Options:
25+
-h, --help Print help
26+
-V, --version Print version
27+
```
28+
29+
## Installation
30+
31+
#### Cargo
32+
33+
```
34+
cargo install devmode
35+
```
36+
#### Arch Linux
37+
```
38+
paru -S devmode-git
39+
```
40+
## Cloning
41+
42+
When you clone a repository it will be stored to your filesystem using a specific folder structure.
43+
44+
You can also use ` dm cl`
45+
46+
```
47+
$HOME
48+
└── Developer
49+
└── host
50+
└── owner
51+
└── repo
52+
```
53+
54+
| Syntax | Description | Example |
55+
| ---------------- | ------------------------- | ------------------------------------------------ |
56+
| `dm clone <url>` | Clone by providing a URL. | `dm clone https://github.com/edfloreshz/devmode` |
57+
58+
# Dependencies
59+
- openssl
60+
61+
## Proposals
62+
63+
If you have a proposal for a new feature, open a new [issue](https://github.com/edfloreshz/devmode/issues).

assets/img/devmode.png

114 KB
Loading

assets/img/logo.png

-39.5 KB
Binary file not shown.

cli/Cargo.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[package]
2+
name = "devmode"
3+
version.workspace = true
4+
description.workspace = true
5+
authors.workspace = true
6+
edition.workspace = true
7+
license.workspace = true
8+
repository.workspace = true
9+
homepage.workspace = true
10+
categories.workspace = true
11+
keywords.workspace = true
12+
exclude.workspace = true
13+
readme.workspace = true
14+
15+
[[bin]]
16+
name = "dm"
17+
path = "src/main.rs"
18+
19+
[dependencies]
20+
thiserror = { workspace = true }
21+
log = { workspace = true }
22+
pretty_env_logger = "0.5.0"
23+
clap = { version = "4.5.23", features = ["derive", "cargo"] }
24+
git2 = { workspace = true }
25+
git2_credentials = { workspace = true }
26+
git-url-parse = { workspace = true }
27+
dirs = { workspace = true }

cli/src/cli.rs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
use crate::Error;
2+
use clap::{Parser, Subcommand};
3+
use devmode::{services, CliError};
4+
5+
#[derive(Parser, Debug)]
6+
#[clap(name = "Devmode")]
7+
#[clap(about = "Devmode is a project management utility for developers.")]
8+
#[clap(author, version, about, arg_required_else_help = true)]
9+
pub struct Cli {
10+
#[command(subcommand)]
11+
pub commands: Commands,
12+
}
13+
14+
#[derive(Subcommand, Debug)]
15+
pub enum Commands {
16+
#[command(
17+
about = "Clones a repository in a specific folder structure.",
18+
name = "cl"
19+
)]
20+
Clone {
21+
#[arg(help = "Provide either a Git <url> or a Git <host> <owner> <repo>.")]
22+
url: String,
23+
},
24+
}
25+
26+
impl Cli {
27+
pub fn run(&self) -> Result<(), Error> {
28+
match &self.commands {
29+
Commands::Clone { url } => match services::clone(&url) {
30+
Ok(_) => {
31+
log::info!("Repository cloned to {}", url);
32+
Ok(())
33+
}
34+
Err(services::Error::Clone(services::CloneError::PathExists(path))) => {
35+
if overwrite() {
36+
std::fs::remove_dir_all(&path)?;
37+
log::info!("Removing existing repository at {}", path.display());
38+
log::info!("Cloning {}...", url.to_string());
39+
services::clone(&url)?;
40+
log::info!("Repository cloned to {}", path.display());
41+
Ok(())
42+
} else {
43+
Err(CliError::RepositoryExists.into())
44+
}
45+
}
46+
Err(e) => Err(e.into()),
47+
},
48+
}
49+
}
50+
}
51+
52+
fn overwrite() -> bool {
53+
println!("Found existing repository, overwrite it? y/n");
54+
let mut input = String::new();
55+
std::io::stdin().read_line(&mut input).unwrap();
56+
matches!(input.trim(), "y" | "Y")
57+
}

cli/src/error.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
use thiserror::Error;
2+
3+
#[derive(Error, Debug)]
4+
pub enum Error {
5+
#[error("{0}")]
6+
Services(#[from] crate::services::Error),
7+
#[error("{0}")]
8+
Parse(#[from] clap::Error),
9+
#[error("{0}")]
10+
Io(#[from] std::io::Error),
11+
#[error("{0}")]
12+
Cli(#[from] CliError),
13+
}
14+
15+
#[derive(Error, Debug)]
16+
pub enum CliError {
17+
#[error("Repository already exists")]
18+
RepositoryExists,
19+
}

0 commit comments

Comments
 (0)