Skip to content

Commit

Permalink
feat: add env configuration for upstream and ssh key (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
graysonarts authored Jul 19, 2024
1 parent 1060a60 commit bd1c247
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description = "A tool to prune merged remote branches from the local repository.
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
clap = { version = "4.5.7", features = ["derive"] }
clap = { version = "4.5.7", features = ["derive", "color", "env"] }
color-eyre = "0.6.3"
const_format = "0.2.32"
git-version = "0.3.9"
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,18 @@ Delete the branches

```
> git superprune -h
Prune local branches that no longer exist on the remote
Usage: git-superprune [OPTIONS] [ROOT]
Arguments:
[ROOT] Root directory of the git repository
Options:
-v, --verbose Display verbose output
-u, --upstream <UPSTREAM> run `git remote prune <upstream>` before scanning [env: SUPERPRUNE_UPSTREAM_REMOTE=origin]
-s, --ssh-key <SSH_KEY> SSH key in `~/.ssh/`` to use for authentication with remote, defaults to `id_rsa` [env: SUPERPRUNE_SSH_KEY=]
-x, --execute Execute the branch deletion
-h, --help Print help
-V, --version Print version
```
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ struct Args {
verbose: bool,

/// run `git remote prune <upstream>` before scanning
#[clap(short, long, required = false)]
#[clap(short, long, required = false, env = "SUPERPRUNE_UPSTREAM_REMOTE")]
upstream: Option<String>,

/// SSH key in `~/.ssh/`` to use for authentication with remote, defaults to `id_rsa`
#[clap(short, long, required = false)]
#[clap(short, long, required = false, env = "SUPERPRUNE_SSH_KEY")]
ssh_key: Option<String>,

#[clap(short('x'), long, default_value = "false")]
Expand Down

0 comments on commit bd1c247

Please sign in to comment.