Skip to content

Commit

Permalink
feat(args)!: prefix environment variables with GIT_CLIFF_ (#76)
Browse files Browse the repository at this point in the history
* Prefix environment variable with `GIT_CLIFF_`

* Update README.md

* Format file
  • Loading branch information
uyha authored Apr 4, 2022
1 parent 312b654 commit 84507dd
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 26 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,16 @@ git-cliff [FLAGS] [OPTIONS] [--] [RANGE]
**Options:**

```
-c, --config <PATH> Sets the configuration file [env: CONFIG=] [default: cliff.toml]
-w, --workdir <PATH> Sets the working directory [env: WORKDIR=]
-r, --repository <PATH> Sets the git repository [env: REPOSITORY=]
--include-path <PATTERN>... Sets the path to include related commits [env: INCLUDE_PATH=]
--exclude-path <PATTERN>... Sets the path to exclude related commits [env: EXCLUDE_PATH=]
--with-commit <MSG>... Sets custom commit messages to include in the changelog [env: WITH_COMMIT=]
-p, --prepend <PATH> Prepends entries to the given changelog file [env: PREPEND=]
-o, --output <PATH> Writes output to the given file [env: OUTPUT=]
-t, --tag <TAG> Sets the tag for the latest version [env: TAG=]
-b, --body <TEMPLATE> Sets the template for the changelog body [env: TEMPLATE=]
-c, --config <PATH> Sets the configuration file [env: GIT_CLIFF_CONFIG=] [default: cliff.toml]
-w, --workdir <PATH> Sets the working directory [env: GIT_CLIFF_WORKDIR=]
-r, --repository <PATH> Sets the git repository [env: GIT_CLIFF_REPOSITORY=]
--include-path <PATTERN>... Sets the path to include related commits [env: GIT_CLIFF_INCLUDE_PATH=]
--exclude-path <PATTERN>... Sets the path to exclude related commits [env: GIT_CLIFF_EXCLUDE_PATH=]
--with-commit <MSG>... Sets custom commit messages to include in the changelog [env: GIT_CLIFF_WITH_COMMIT=]
-p, --prepend <PATH> Prepends entries to the given changelog file [env: GIT_CLIFF_PREPEND=]
-o, --output <PATH> Writes output to the given file [env: GIT_CLIFF_OUTPUT=]
-t, --tag <TAG> Sets the tag for the latest version [env: GIT_CLIFF_TAG=]
-b, --body <TEMPLATE> Sets the template for the changelog body [env: GIT_CLIFF_TEMPLATE=]
-s, --strip <PART> Strips the given parts from the changelog [possible values: header, footer, all]
--sort <SORT> Sets sorting of the commits inside sections [default: oldest] [possible values: oldest, newest]
```
Expand Down
47 changes: 31 additions & 16 deletions git-cliff/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,43 +38,58 @@ pub struct Opt {
#[clap(short, long, parse(from_occurrences), alias = "debug", help_heading = Some("FLAGS"))]
pub verbose: u8,
/// Sets the configuration file.
#[clap(
short,
long,
env,
value_name = "PATH",
default_value = DEFAULT_CONFIG,
)]
#[clap(short, long, env = "GIT_CLIFF_CONFIG", value_name = "PATH", default_value = DEFAULT_CONFIG)]
pub config: PathBuf,
/// Sets the working directory.
#[clap(short, long, env, value_name = "PATH")]
#[clap(short, long, env = "GIT_CLIFF_WORKDIR", value_name = "PATH")]
pub workdir: Option<PathBuf>,
/// Sets the git repository.
#[clap(short, long, env, value_name = "PATH")]
#[clap(short, long, env = "GIT_CLIFF_REPOSITORY", value_name = "PATH")]
pub repository: Option<PathBuf>,
/// Sets the path to include related commits.
#[clap(long, env, value_name = "PATTERN", multiple_values = true)]
#[clap(
long,
env = "GIT_CLIFF_INCLUDE_PATH",
value_name = "PATTERN",
multiple_values = true
)]
pub include_path: Option<Vec<Pattern>>,
/// Sets the path to exclude related commits.
#[clap(long, env, value_name = "PATTERN", multiple_values = true)]
#[clap(
long,
env = "GIT_CLIFF_EXCLUDE_PATH",
value_name = "PATTERN",
multiple_values = true
)]
pub exclude_path: Option<Vec<Pattern>>,
/// Sets custom commit messages to include in the changelog.
#[clap(long, env, value_name = "MSG", multiple_values = true)]
#[clap(
long,
env = "GIT_CLIFF_WITH_COMMIT",
value_name = "MSG",
multiple_values = true
)]
pub with_commit: Option<Vec<String>>,
/// Prepends entries to the given changelog file.
#[clap(short, long, env, value_name = "PATH")]
#[clap(short, long, env = "GIT_CLIFF_PREPEND", value_name = "PATH")]
pub prepend: Option<PathBuf>,
/// Writes output to the given file.
#[clap(short, long, env, value_name = "PATH")]
#[clap(short, long, env = "GIT_CLIFF_OUTPUT", value_name = "PATH")]
pub output: Option<PathBuf>,
/// Sets the tag for the latest version.
#[clap(short, long, env, value_name = "TAG", allow_hyphen_values = true)]
#[clap(
short,
long,
env = "GIT_CLIFF_TAG",
value_name = "TAG",
allow_hyphen_values = true
)]
pub tag: Option<String>,
/// Sets the template for the changelog body.
#[clap(
short,
long,
env = "TEMPLATE",
env = "GIT_CLIFF_TEMPLATE",
value_name = "TEMPLATE",
allow_hyphen_values = true
)]
Expand Down

0 comments on commit 84507dd

Please sign in to comment.