git-cliff 2.2.2__tar.gz → 2.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. {git_cliff-2.2.2 → git_cliff-2.3.0}/Cargo.lock +40 -33
  2. {git_cliff-2.2.2 → git_cliff-2.3.0}/PKG-INFO +1 -1
  3. {git_cliff-2.2.2 → git_cliff-2.3.0}/git-cliff/Cargo.toml +8 -4
  4. {git_cliff-2.2.2 → git_cliff-2.3.0}/git-cliff/src/args.rs +72 -34
  5. {git_cliff-2.2.2 → git_cliff-2.3.0}/git-cliff/src/lib.rs +56 -2
  6. {git_cliff-2.2.2 → git_cliff-2.3.0}/git-cliff/src/logger.rs +48 -15
  7. {git_cliff-2.2.2 → git_cliff-2.3.0}/git-cliff-core/Cargo.toml +28 -7
  8. {git_cliff-2.2.2 → git_cliff-2.3.0}/git-cliff-core/src/changelog.rs +200 -19
  9. {git_cliff-2.2.2 → git_cliff-2.3.0}/git-cliff-core/src/commit.rs +11 -3
  10. {git_cliff-2.2.2 → git_cliff-2.3.0}/git-cliff-core/src/config.rs +8 -1
  11. {git_cliff-2.2.2 → git_cliff-2.3.0}/git-cliff-core/src/error.rs +3 -3
  12. {git_cliff-2.2.2 → git_cliff-2.3.0}/git-cliff-core/src/lib.rs +5 -4
  13. {git_cliff-2.2.2 → git_cliff-2.3.0}/git-cliff-core/src/release.rs +398 -85
  14. git_cliff-2.3.0/git-cliff-core/src/remote/bitbucket.rs +222 -0
  15. git_cliff-2.3.0/git-cliff-core/src/remote/github.rs +183 -0
  16. git_cliff-2.3.0/git-cliff-core/src/remote/gitlab.rs +287 -0
  17. git_cliff-2.3.0/git-cliff-core/src/remote/mod.rs +368 -0
  18. {git_cliff-2.2.2 → git_cliff-2.3.0}/git-cliff-core/src/template.rs +18 -10
  19. {git_cliff-2.2.2 → git_cliff-2.3.0}/git-cliff-core/tests/integration_test.rs +18 -2
  20. git_cliff-2.2.2/git-cliff-core/src/github.rs +0 -288
  21. {git_cliff-2.2.2 → git_cliff-2.3.0}/Cargo.toml +0 -0
  22. {git_cliff-2.2.2 → git_cliff-2.3.0}/README.md +0 -0
  23. {git_cliff-2.2.2 → git_cliff-2.3.0}/git-cliff/src/bin/completions.rs +0 -0
  24. {git_cliff-2.2.2 → git_cliff-2.3.0}/git-cliff/src/bin/mangen.rs +0 -0
  25. {git_cliff-2.2.2 → git_cliff-2.3.0}/git-cliff/src/main.rs +0 -0
  26. {git_cliff-2.2.2 → git_cliff-2.3.0}/git-cliff-core/src/command.rs +0 -0
  27. {git_cliff-2.2.2 → git_cliff-2.3.0}/git-cliff-core/src/embed.rs +0 -0
  28. {git_cliff-2.2.2 → git_cliff-2.3.0}/git-cliff-core/src/repo.rs +0 -0
  29. {git_cliff-2.2.2 → git_cliff-2.3.0}/pyproject.toml +0 -0
@@ -270,9 +270,9 @@ dependencies = [
270
270
 
271
271
  [[package]]
272
272
  name = "chrono-tz"
273
- version = "0.8.6"
273
+ version = "0.9.0"
274
274
  source = "registry+https://github.com/rust-lang/crates.io-index"
275
- checksum = "d59ae0466b83e838b81a54256c39d5d7c20b9d7daa10510a242d9b75abd5936e"
275
+ checksum = "93698b29de5e97ad0ae26447b344c482a7284c737d9ddc5f9e52b74a336671bb"
276
276
  dependencies = [
277
277
  "chrono",
278
278
  "chrono-tz-build",
@@ -281,9 +281,9 @@ dependencies = [
281
281
 
282
282
  [[package]]
283
283
  name = "chrono-tz-build"
284
- version = "0.2.1"
284
+ version = "0.3.0"
285
285
  source = "registry+https://github.com/rust-lang/crates.io-index"
286
- checksum = "433e39f13c9a060046954e0592a8d0a4bcb1040125cbf91cb8ee58964cfb350f"
286
+ checksum = "0c088aee841df9c3041febbb73934cfc39708749bf96dc827e3359cd39ef11b1"
287
287
  dependencies = [
288
288
  "parse-zoneinfo",
289
289
  "phf",
@@ -544,6 +544,12 @@ dependencies = [
544
544
  "litrs",
545
545
  ]
546
546
 
547
+ [[package]]
548
+ name = "dyn-clone"
549
+ version = "1.0.17"
550
+ source = "registry+https://github.com/rust-lang/crates.io-index"
551
+ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
552
+
547
553
  [[package]]
548
554
  name = "either"
549
555
  version = "1.11.0"
@@ -753,7 +759,7 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
753
759
 
754
760
  [[package]]
755
761
  name = "git-cliff"
756
- version = "2.2.2"
762
+ version = "2.3.0"
757
763
  dependencies = [
758
764
  "clap",
759
765
  "clap_complete",
@@ -774,11 +780,12 @@ dependencies = [
774
780
 
775
781
  [[package]]
776
782
  name = "git-cliff-core"
777
- version = "2.2.2"
783
+ version = "2.3.0"
778
784
  dependencies = [
779
785
  "config",
780
786
  "dirs",
781
787
  "document-features",
788
+ "dyn-clone",
782
789
  "expect-test",
783
790
  "futures",
784
791
  "git-conventional",
@@ -853,11 +860,11 @@ dependencies = [
853
860
 
854
861
  [[package]]
855
862
  name = "globwalk"
856
- version = "0.8.1"
863
+ version = "0.9.1"
857
864
  source = "registry+https://github.com/rust-lang/crates.io-index"
858
- checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc"
865
+ checksum = "0bf760ebf69878d9fd8f110c89703d90ce35095324d1f1edcb595c63945ee757"
859
866
  dependencies = [
860
- "bitflags 1.3.2",
867
+ "bitflags 2.5.0",
861
868
  "ignore",
862
869
  "walkdir",
863
870
  ]
@@ -1490,9 +1497,9 @@ dependencies = [
1490
1497
 
1491
1498
  [[package]]
1492
1499
  name = "next_version"
1493
- version = "0.2.16"
1500
+ version = "0.2.17"
1494
1501
  source = "registry+https://github.com/rust-lang/crates.io-index"
1495
- checksum = "d3e541a09da6184deaa5f0c9eeec570dbea6ea841d92c84cdfa4ff985aa535fa"
1502
+ checksum = "7beae5e84c3330a90f0f89eae10f5cd4c17c3be0f119ab36d94fd908c7b8c8fb"
1496
1503
  dependencies = [
1497
1504
  "conventional_commit_parser",
1498
1505
  "semver",
@@ -2130,18 +2137,18 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
2130
2137
 
2131
2138
  [[package]]
2132
2139
  name = "serde"
2133
- version = "1.0.201"
2140
+ version = "1.0.203"
2134
2141
  source = "registry+https://github.com/rust-lang/crates.io-index"
2135
- checksum = "780f1cebed1629e4753a1a38a3c72d30b97ec044f0aef68cb26650a3c5cf363c"
2142
+ checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094"
2136
2143
  dependencies = [
2137
2144
  "serde_derive",
2138
2145
  ]
2139
2146
 
2140
2147
  [[package]]
2141
2148
  name = "serde_derive"
2142
- version = "1.0.201"
2149
+ version = "1.0.203"
2143
2150
  source = "registry+https://github.com/rust-lang/crates.io-index"
2144
- checksum = "c5e405930b9796f1c00bee880d03fc7e0bb4b9a11afc776885ffe84320da2865"
2151
+ checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
2145
2152
  dependencies = [
2146
2153
  "proc-macro2",
2147
2154
  "quote",
@@ -2171,9 +2178,9 @@ dependencies = [
2171
2178
 
2172
2179
  [[package]]
2173
2180
  name = "serde_spanned"
2174
- version = "0.6.5"
2181
+ version = "0.6.6"
2175
2182
  source = "registry+https://github.com/rust-lang/crates.io-index"
2176
- checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1"
2183
+ checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0"
2177
2184
  dependencies = [
2178
2185
  "serde",
2179
2186
  ]
@@ -2371,9 +2378,9 @@ dependencies = [
2371
2378
 
2372
2379
  [[package]]
2373
2380
  name = "tera"
2374
- version = "1.19.1"
2381
+ version = "1.20.0"
2375
2382
  source = "registry+https://github.com/rust-lang/crates.io-index"
2376
- checksum = "970dff17c11e884a4a09bc76e3a17ef71e01bb13447a11e85226e254fe6d10b8"
2383
+ checksum = "ab9d851b45e865f178319da0abdbfe6acbc4328759ff18dafc3a41c16b4cd2ee"
2377
2384
  dependencies = [
2378
2385
  "chrono",
2379
2386
  "chrono-tz",
@@ -2412,18 +2419,18 @@ dependencies = [
2412
2419
 
2413
2420
  [[package]]
2414
2421
  name = "thiserror"
2415
- version = "1.0.60"
2422
+ version = "1.0.61"
2416
2423
  source = "registry+https://github.com/rust-lang/crates.io-index"
2417
- checksum = "579e9083ca58dd9dcf91a9923bb9054071b9ebbd800b342194c9feb0ee89fc18"
2424
+ checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709"
2418
2425
  dependencies = [
2419
2426
  "thiserror-impl",
2420
2427
  ]
2421
2428
 
2422
2429
  [[package]]
2423
2430
  name = "thiserror-impl"
2424
- version = "1.0.60"
2431
+ version = "1.0.61"
2425
2432
  source = "registry+https://github.com/rust-lang/crates.io-index"
2426
- checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524"
2433
+ checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
2427
2434
  dependencies = [
2428
2435
  "proc-macro2",
2429
2436
  "quote",
@@ -2478,9 +2485,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
2478
2485
 
2479
2486
  [[package]]
2480
2487
  name = "tokio"
2481
- version = "1.37.0"
2488
+ version = "1.38.0"
2482
2489
  source = "registry+https://github.com/rust-lang/crates.io-index"
2483
- checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787"
2490
+ checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a"
2484
2491
  dependencies = [
2485
2492
  "backtrace",
2486
2493
  "bytes",
@@ -2495,9 +2502,9 @@ dependencies = [
2495
2502
 
2496
2503
  [[package]]
2497
2504
  name = "tokio-macros"
2498
- version = "2.2.0"
2505
+ version = "2.3.0"
2499
2506
  source = "registry+https://github.com/rust-lang/crates.io-index"
2500
- checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
2507
+ checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a"
2501
2508
  dependencies = [
2502
2509
  "proc-macro2",
2503
2510
  "quote",
@@ -2551,9 +2558,9 @@ dependencies = [
2551
2558
 
2552
2559
  [[package]]
2553
2560
  name = "toml"
2554
- version = "0.8.12"
2561
+ version = "0.8.13"
2555
2562
  source = "registry+https://github.com/rust-lang/crates.io-index"
2556
- checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3"
2563
+ checksum = "a4e43f8cc456c9704c851ae29c67e17ef65d2c30017c17a9765b89c382dc8bba"
2557
2564
  dependencies = [
2558
2565
  "serde",
2559
2566
  "serde_spanned",
@@ -2563,18 +2570,18 @@ dependencies = [
2563
2570
 
2564
2571
  [[package]]
2565
2572
  name = "toml_datetime"
2566
- version = "0.6.5"
2573
+ version = "0.6.6"
2567
2574
  source = "registry+https://github.com/rust-lang/crates.io-index"
2568
- checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
2575
+ checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf"
2569
2576
  dependencies = [
2570
2577
  "serde",
2571
2578
  ]
2572
2579
 
2573
2580
  [[package]]
2574
2581
  name = "toml_edit"
2575
- version = "0.22.12"
2582
+ version = "0.22.13"
2576
2583
  source = "registry+https://github.com/rust-lang/crates.io-index"
2577
- checksum = "d3328d4f68a705b2a4498da1d580585d39a6510f98318a2cec3018a7ec61ddef"
2584
+ checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c"
2578
2585
  dependencies = [
2579
2586
  "indexmap",
2580
2587
  "serde",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: git-cliff
3
- Version: 2.2.2
3
+ Version: 2.3.0
4
4
  Classifier: Intended Audience :: Developers
5
5
  Classifier: Topic :: Software Development
6
6
  Classifier: Programming Language :: Rust
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "git-cliff"
3
- version = "2.2.2" # managed by release.sh
3
+ version = "2.3.0" # managed by release.sh
4
4
  description = "A highly customizable changelog generator ⛰️"
5
5
  authors = ["git-cliff contributors <git-cliff@protonmail.com>"]
6
6
  license = "MIT OR Apache-2.0"
@@ -11,7 +11,7 @@ keywords = ["changelog", "generator", "conventional", "commit"]
11
11
  categories = ["command-line-utilities"]
12
12
  default-run = "git-cliff"
13
13
  edition = "2021"
14
- rust-version = "1.74.1"
14
+ rust-version = "1.75.0"
15
15
 
16
16
  [[bin]]
17
17
  name = "git-cliff-completions"
@@ -23,11 +23,15 @@ path = "src/bin/mangen.rs"
23
23
 
24
24
  [features]
25
25
  # check for new versions
26
- default = ["update-informer", "github"]
26
+ default = ["update-informer", "github", "gitlab", "bitbucket"]
27
27
  # inform about new releases
28
28
  update-informer = ["dep:update-informer"]
29
29
  # enable GitHub integration
30
30
  github = ["git-cliff-core/github", "dep:indicatif"]
31
+ # enable GitLab integration
32
+ gitlab = ["git-cliff-core/gitlab", "dep:indicatif"]
33
+ # enable Bitbucket integration
34
+ bitbucket = ["git-cliff-core/bitbucket", "dep:indicatif"]
31
35
 
32
36
  [dependencies]
33
37
  glob.workspace = true
@@ -45,7 +49,7 @@ indicatif = { version = "0.17.8", optional = true }
45
49
  env_logger = "0.10.2"
46
50
 
47
51
  [dependencies.git-cliff-core]
48
- version = "2.2.2" # managed by release.sh
52
+ version = "2.3.0" # managed by release.sh
49
53
  path = "../git-cliff-core"
50
54
 
51
55
  [dev-dependencies]
@@ -64,7 +64,7 @@ pub struct Opt {
64
64
  help = "Prints help information",
65
65
  help_heading = "FLAGS"
66
66
  )]
67
- pub help: Option<bool>,
67
+ pub help: Option<bool>,
68
68
  #[arg(
69
69
  short = 'V',
70
70
  long,
@@ -73,10 +73,10 @@ pub struct Opt {
73
73
  help = "Prints version information",
74
74
  help_heading = "FLAGS"
75
75
  )]
76
- pub version: Option<bool>,
76
+ pub version: Option<bool>,
77
77
  /// Increases the logging verbosity.
78
78
  #[arg(short, long, action = ArgAction::Count, alias = "debug", help_heading = Some("FLAGS"))]
79
- pub verbose: u8,
79
+ pub verbose: u8,
80
80
  /// Writes the default configuration file to cliff.toml
81
81
  #[arg(
82
82
  short,
@@ -85,7 +85,7 @@ pub struct Opt {
85
85
  num_args = 0..=1,
86
86
  required = false
87
87
  )]
88
- pub init: Option<Option<String>>,
88
+ pub init: Option<Option<String>>,
89
89
  /// Sets the configuration file.
90
90
  #[arg(
91
91
  short,
@@ -95,7 +95,7 @@ pub struct Opt {
95
95
  default_value = DEFAULT_CONFIG,
96
96
  value_parser = Opt::parse_dir
97
97
  )]
98
- pub config: PathBuf,
98
+ pub config: PathBuf,
99
99
  /// Sets the working directory.
100
100
  #[arg(
101
101
  short,
@@ -104,7 +104,7 @@ pub struct Opt {
104
104
  value_name = "PATH",
105
105
  value_parser = Opt::parse_dir
106
106
  )]
107
- pub workdir: Option<PathBuf>,
107
+ pub workdir: Option<PathBuf>,
108
108
  /// Sets the git repository.
109
109
  #[arg(
110
110
  short,
@@ -114,7 +114,7 @@ pub struct Opt {
114
114
  num_args(1..),
115
115
  value_parser = Opt::parse_dir
116
116
  )]
117
- pub repository: Option<Vec<PathBuf>>,
117
+ pub repository: Option<Vec<PathBuf>>,
118
118
  /// Sets the path to include related commits.
119
119
  #[arg(
120
120
  long,
@@ -122,7 +122,7 @@ pub struct Opt {
122
122
  value_name = "PATTERN",
123
123
  num_args(1..)
124
124
  )]
125
- pub include_path: Option<Vec<Pattern>>,
125
+ pub include_path: Option<Vec<Pattern>>,
126
126
  /// Sets the path to exclude related commits.
127
127
  #[arg(
128
128
  long,
@@ -130,10 +130,10 @@ pub struct Opt {
130
130
  value_name = "PATTERN",
131
131
  num_args(1..)
132
132
  )]
133
- pub exclude_path: Option<Vec<Pattern>>,
133
+ pub exclude_path: Option<Vec<Pattern>>,
134
134
  /// Sets the regex for matching git tags.
135
135
  #[arg(long, env = "GIT_CLIFF_TAG_PATTERN", value_name = "PATTERN")]
136
- pub tag_pattern: Option<Regex>,
136
+ pub tag_pattern: Option<Regex>,
137
137
  /// Sets custom commit messages to include in the changelog.
138
138
  #[arg(
139
139
  long,
@@ -141,7 +141,7 @@ pub struct Opt {
141
141
  value_name = "MSG",
142
142
  num_args(1..)
143
143
  )]
144
- pub with_commit: Option<Vec<String>>,
144
+ pub with_commit: Option<Vec<String>>,
145
145
  /// Sets commits that will be skipped in the changelog.
146
146
  #[arg(
147
147
  long,
@@ -149,7 +149,7 @@ pub struct Opt {
149
149
  value_name = "SHA1",
150
150
  num_args(1..)
151
151
  )]
152
- pub skip_commit: Option<Vec<String>>,
152
+ pub skip_commit: Option<Vec<String>>,
153
153
  /// Prepends entries to the given changelog file.
154
154
  #[arg(
155
155
  short,
@@ -158,7 +158,7 @@ pub struct Opt {
158
158
  value_name = "PATH",
159
159
  value_parser = Opt::parse_dir
160
160
  )]
161
- pub prepend: Option<PathBuf>,
161
+ pub prepend: Option<PathBuf>,
162
162
  /// Writes output to the given file.
163
163
  #[arg(
164
164
  short,
@@ -169,7 +169,7 @@ pub struct Opt {
169
169
  num_args = 0..=1,
170
170
  default_missing_value = DEFAULT_OUTPUT
171
171
  )]
172
- pub output: Option<PathBuf>,
172
+ pub output: Option<PathBuf>,
173
173
  /// Sets the tag for the latest version.
174
174
  #[arg(
175
175
  short,
@@ -178,13 +178,13 @@ pub struct Opt {
178
178
  value_name = "TAG",
179
179
  allow_hyphen_values = true
180
180
  )]
181
- pub tag: Option<String>,
181
+ pub tag: Option<String>,
182
182
  /// Bumps the version for unreleased changes.
183
183
  #[arg(long, help_heading = Some("FLAGS"))]
184
- pub bump: bool,
184
+ pub bump: bool,
185
185
  /// Prints bumped version for unreleased changes.
186
186
  #[arg(long, help_heading = Some("FLAGS"))]
187
- pub bumped_version: bool,
187
+ pub bumped_version: bool,
188
188
  /// Sets the template for the changelog body.
189
189
  #[arg(
190
190
  short,
@@ -193,54 +193,92 @@ pub struct Opt {
193
193
  value_name = "TEMPLATE",
194
194
  allow_hyphen_values = true
195
195
  )]
196
- pub body: Option<String>,
196
+ pub body: Option<String>,
197
197
  /// Processes the commits starting from the latest tag.
198
198
  #[arg(short, long, help_heading = Some("FLAGS"))]
199
- pub latest: bool,
199
+ pub latest: bool,
200
200
  /// Processes the commits that belong to the current tag.
201
201
  #[arg(long, help_heading = Some("FLAGS"))]
202
- pub current: bool,
202
+ pub current: bool,
203
203
  /// Processes the commits that do not belong to a tag.
204
204
  #[arg(short, long, help_heading = Some("FLAGS"))]
205
- pub unreleased: bool,
205
+ pub unreleased: bool,
206
206
  /// Sorts the tags topologically.
207
207
  #[arg(long, help_heading = Some("FLAGS"))]
208
- pub topo_order: bool,
208
+ pub topo_order: bool,
209
209
  /// Disables the external command execution.
210
210
  #[arg(long, help_heading = Some("FLAGS"))]
211
- pub no_exec: bool,
211
+ pub no_exec: bool,
212
212
  /// Prints changelog context as JSON.
213
213
  #[arg(short = 'x', long, help_heading = Some("FLAGS"))]
214
- pub context: bool,
214
+ pub context: bool,
215
215
  /// Strips the given parts from the changelog.
216
216
  #[arg(short, long, value_name = "PART", value_enum)]
217
- pub strip: Option<Strip>,
217
+ pub strip: Option<Strip>,
218
218
  /// Sets sorting of the commits inside sections.
219
219
  #[arg(
220
220
  long,
221
221
  value_enum,
222
222
  default_value_t = Sort::Oldest
223
223
  )]
224
- pub sort: Sort,
224
+ pub sort: Sort,
225
225
  /// Sets the commit range to process.
226
226
  #[arg(value_name = "RANGE", help_heading = Some("ARGS"))]
227
- pub range: Option<String>,
227
+ pub range: Option<String>,
228
228
  /// Sets the GitHub API token.
229
229
  #[arg(
230
230
  long,
231
231
  env = "GITHUB_TOKEN",
232
232
  value_name = "TOKEN",
233
- hide_env_values = true
233
+ hide_env_values = true,
234
+ hide = !cfg!(feature = "github"),
234
235
  )]
235
- pub github_token: Option<SecretString>,
236
+ pub github_token: Option<SecretString>,
236
237
  /// Sets the GitHub repository.
237
238
  #[arg(
238
- long,
239
- env = "GITHUB_REPO",
240
- value_parser = clap::value_parser!(RemoteValue),
241
- value_name = "OWNER/REPO"
239
+ long,
240
+ env = "GITHUB_REPO",
241
+ value_parser = clap::value_parser!(RemoteValue),
242
+ value_name = "OWNER/REPO",
243
+ hide = !cfg!(feature = "github"),
244
+ )]
245
+ pub github_repo: Option<RemoteValue>,
246
+ /// Sets the GitLab API token.
247
+ #[arg(
248
+ long,
249
+ env = "GITLAB_TOKEN",
250
+ value_name = "TOKEN",
251
+ hide_env_values = true,
252
+ hide = !cfg!(feature = "gitlab"),
253
+ )]
254
+ pub gitlab_token: Option<SecretString>,
255
+ /// Sets the GitLab repository.
256
+ #[arg(
257
+ long,
258
+ env = "GITLAB_REPO",
259
+ value_parser = clap::value_parser!(RemoteValue),
260
+ value_name = "OWNER/REPO",
261
+ hide = !cfg!(feature = "gitlab"),
262
+ )]
263
+ pub gitlab_repo: Option<RemoteValue>,
264
+ /// Sets the Bitbucket API token.
265
+ #[arg(
266
+ long,
267
+ env = "BITBUCKET_TOKEN",
268
+ value_name = "TOKEN",
269
+ hide_env_values = true,
270
+ hide = !cfg!(feature = "bitbucket"),
271
+ )]
272
+ pub bitbucket_token: Option<SecretString>,
273
+ /// Sets the Bitbucket repository.
274
+ #[arg(
275
+ long,
276
+ env = "BITBUCKET_REPO",
277
+ value_parser = clap::value_parser!(RemoteValue),
278
+ value_name = "OWNER/REPO",
279
+ hide = !cfg!(feature = "bitbucket"),
242
280
  )]
243
- pub github_repo: Option<RemoteValue>,
281
+ pub bitbucket_repo: Option<RemoteValue>,
244
282
  }
245
283
 
246
284
  /// Custom type for the remote value.
@@ -48,6 +48,7 @@ use std::io::{
48
48
  self,
49
49
  Write,
50
50
  };
51
+ use std::path::PathBuf;
51
52
  use std::time::{
52
53
  SystemTime,
53
54
  UNIX_EPOCH,
@@ -119,7 +120,29 @@ fn process_repository<'a>(
119
120
  config.remote.github.repo = remote.repo;
120
121
  }
121
122
  Err(e) => {
122
- debug!("Failed to get remote from repository: {:?}", e);
123
+ debug!("Failed to get remote from GitHub repository: {:?}", e);
124
+ }
125
+ }
126
+ } else if !config.remote.gitlab.is_set() {
127
+ match repository.upstream_remote() {
128
+ Ok(remote) => {
129
+ debug!("No GitLab remote is set, using remote: {}", remote);
130
+ config.remote.gitlab.owner = remote.owner;
131
+ config.remote.gitlab.repo = remote.repo;
132
+ }
133
+ Err(e) => {
134
+ debug!("Failed to get remote from GitLab repository: {:?}", e);
135
+ }
136
+ }
137
+ } else if !config.remote.bitbucket.is_set() {
138
+ match repository.upstream_remote() {
139
+ Ok(remote) => {
140
+ debug!("No Bitbucket remote is set, using remote: {}", remote);
141
+ config.remote.bitbucket.owner = remote.owner;
142
+ config.remote.bitbucket.repo = remote.repo;
143
+ }
144
+ Err(e) => {
145
+ debug!("Failed to get remote from Bitbucket repository: {:?}", e);
123
146
  }
124
147
  }
125
148
  }
@@ -385,6 +408,15 @@ pub fn run(mut args: Opt) -> Result<()> {
385
408
  )));
386
409
  }
387
410
  }
411
+ if args.output.is_some() &&
412
+ args.prepend.is_some() &&
413
+ args.output.as_ref() == args.prepend.as_ref()
414
+ {
415
+ return Err(Error::ArgumentError(String::from(
416
+ "'-o' and '-p' can only be used together if they point to different \
417
+ files",
418
+ )));
419
+ }
388
420
  if args.body.is_some() {
389
421
  config.changelog.body.clone_from(&args.body);
390
422
  }
@@ -402,10 +434,28 @@ pub fn run(mut args: Opt) -> Result<()> {
402
434
  if args.github_token.is_some() {
403
435
  config.remote.github.token.clone_from(&args.github_token);
404
436
  }
437
+ if args.gitlab_token.is_some() {
438
+ config.remote.gitlab.token.clone_from(&args.gitlab_token);
439
+ }
440
+ if args.bitbucket_token.is_some() {
441
+ config
442
+ .remote
443
+ .bitbucket
444
+ .token
445
+ .clone_from(&args.bitbucket_token);
446
+ }
405
447
  if let Some(ref remote) = args.github_repo {
406
448
  config.remote.github.owner = remote.0.owner.to_string();
407
449
  config.remote.github.repo = remote.0.repo.to_string();
408
450
  }
451
+ if let Some(ref remote) = args.gitlab_repo {
452
+ config.remote.gitlab.owner = remote.0.owner.to_string();
453
+ config.remote.gitlab.repo = remote.0.repo.to_string();
454
+ }
455
+ if let Some(ref remote) = args.bitbucket_repo {
456
+ config.remote.bitbucket.owner = remote.0.owner.to_string();
457
+ config.remote.bitbucket.repo = remote.0.repo.to_string();
458
+ }
409
459
  if args.no_exec {
410
460
  if let Some(ref mut preprocessors) = config.git.commit_preprocessors {
411
461
  preprocessors
@@ -498,7 +548,11 @@ pub fn run(mut args: Opt) -> Result<()> {
498
548
  changelog.prepend(fs::read_to_string(path)?, &mut File::create(path)?)?;
499
549
  }
500
550
  if let Some(path) = args.output {
501
- let mut output = File::create(path)?;
551
+ let mut output: Box<dyn Write> = if path == PathBuf::from("-") {
552
+ Box::new(io::stdout())
553
+ } else {
554
+ Box::new(File::create(path)?)
555
+ };
502
556
  if args.context {
503
557
  changelog.write_context(&mut output)
504
558
  } else {