Skip to content

Commit f952c10

Browse files
committed
doc: Add missing command docs + small style fixups
Changes that affect the help/usage text shown at runtime: - Add descriptions for a few `gix` commands that didn't have it: `gix is-clean`, `gix is-changed`, and `gix env`. - Add a description of the debug-only `ein panic` command. - Small spacing and capitalization improvements for consistency. - Add a line break in a `///` block for brevity of the top line. Changes to code style that do not affect what is shown at runtime: - Add `.` at the end of some `///` first lines. (This doesn't affect runtime behavior because `clap` normalizes this away.) - Put `///` above all `#[...]` in a few places where it wasn't. - Adjust comment wrapping in a couple of places for clarity.
1 parent 1612c73 commit f952c10

File tree

2 files changed

+40
-34
lines changed

2 files changed

+40
-34
lines changed

src/plumbing/options/mod.rs

+35-30
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ pub struct Args {
2222
#[clap(long, short = 'c', value_parser = crate::shared::AsBString)]
2323
pub config: Vec<BString>,
2424

25-
#[clap(long, short = 't')]
2625
/// The amount of threads to use for some operations.
2726
///
2827
/// If unset, or the value is 0, there is no limit and all logical cores can be used.
28+
#[clap(long, short = 't')]
2929
pub threads: Option<usize>,
3030

3131
/// Display verbose messages and progress information
@@ -41,7 +41,7 @@ pub struct Args {
4141
#[clap(long, conflicts_with("verbose"))]
4242
pub no_verbose: bool,
4343

44-
/// Bring up a terminal user interface displaying progress visually
44+
/// Bring up a terminal user interface displaying progress visually.
4545
#[cfg(feature = "prodash-render-tui")]
4646
#[clap(long, conflicts_with("verbose"))]
4747
pub progress: bool,
@@ -80,13 +80,13 @@ pub struct Args {
8080

8181
#[derive(Debug, clap::Subcommand)]
8282
pub enum Subcommands {
83-
/// Subcommands for creating worktree archives
83+
/// Subcommands for creating worktree archives.
8484
#[cfg(feature = "gitoxide-core-tools-archive")]
8585
Archive(archive::Platform),
86-
/// Remove untracked files from the working tree
86+
/// Remove untracked files from the working tree.
8787
#[cfg(feature = "gitoxide-core-tools-clean")]
8888
Clean(clean::Command),
89-
/// Subcommands for interacting with commit-graph files
89+
/// Subcommands for interacting with commit-graph files.
9090
#[clap(subcommand)]
9191
CommitGraph(commitgraph::Subcommands),
9292
/// Interact with the object database.
@@ -111,10 +111,10 @@ pub enum Subcommands {
111111
/// A program just like `git credential`.
112112
#[clap(subcommand)]
113113
Credential(credential::Subcommands),
114-
/// Fetch data from remotes and store it in the repository
114+
/// Fetch data from remotes and store it in the repository.
115115
#[cfg(feature = "gitoxide-core-blocking-client")]
116116
Fetch(fetch::Platform),
117-
/// Clone a repository into a new directory
117+
/// Clone a repository into a new directory.
118118
#[cfg(feature = "gitoxide-core-blocking-client")]
119119
Clone(clone::Platform),
120120
/// Interact with the mailmap.
@@ -129,7 +129,7 @@ pub enum Subcommands {
129129
/// Interact with the exclude files like .gitignore.
130130
#[clap(subcommand)]
131131
Exclude(exclude::Subcommands),
132-
/// Interact with a worktree index like .git/index
132+
/// Interact with a worktree index like .git/index.
133133
#[clap(subcommand)]
134134
Index(index::Subcommands),
135135
/// Interact with submodules.
@@ -140,7 +140,9 @@ pub enum Subcommands {
140140
/// The object to print to stdout.
141141
revspec: String,
142142
},
143+
/// Check for changes in the repository, treating this as an error.
143144
IsClean,
145+
/// Check for changes in the repository, treating their absence as an error.
144146
IsChanged,
145147
/// Show which git configuration values are used or planned.
146148
ConfigTree,
@@ -150,14 +152,15 @@ pub enum Subcommands {
150152
Corpus(corpus::Platform),
151153
MergeBase(merge_base::Command),
152154
Merge(merge::Platform),
155+
/// Print paths relevant to the Git installation.
153156
Env,
154157
Diff(diff::Platform),
155158
Log(log::Platform),
156159
Worktree(worktree::Platform),
157-
/// Subcommands that need no git repository to run.
160+
/// Subcommands that need no Git repository to run.
158161
#[clap(subcommand)]
159162
Free(free::Subcommands),
160-
/// Blame lines in a file
163+
/// Blame lines in a file.
161164
Blame {
162165
/// Print additional statistics to help understanding performance.
163166
#[clap(long, short = 's')]
@@ -271,7 +274,7 @@ pub mod status {
271274
}
272275

273276
#[derive(Debug, clap::Parser)]
274-
#[command(about = "compute repository status similar to `git status`")]
277+
#[command(about = "Compute repository status similar to `git status`")]
275278
pub struct Platform {
276279
/// The way status data is displayed.
277280
#[clap(long, short = 'f')]
@@ -318,7 +321,7 @@ pub mod worktree {
318321

319322
#[derive(Debug, clap::Subcommand)]
320323
pub enum SubCommands {
321-
/// List all worktrees, along with some accompanying information
324+
/// List all worktrees, along with some accompanying information.
322325
List,
323326
}
324327
}
@@ -328,7 +331,7 @@ pub mod corpus {
328331
use std::path::PathBuf;
329332

330333
#[derive(Debug, clap::Parser)]
331-
#[command(about = "run algorithms on a corpus of git repositories and store their results for later analysis")]
334+
#[command(about = "Run algorithms on a corpus of git repositories and store their results for later analysis")]
332335
pub struct Platform {
333336
/// The path to the database to read and write depending on the sub-command.
334337
#[arg(long, default_value = "corpus.db")]
@@ -441,7 +444,7 @@ pub mod merge {
441444
}
442445

443446
#[derive(Debug, clap::Parser)]
444-
#[command(about = "perform merges of various kinds")]
447+
#[command(about = "Perform merges of various kinds")]
445448
pub struct Platform {
446449
#[clap(subcommand)]
447450
pub cmd: SubCommands,
@@ -499,7 +502,7 @@ pub mod merge {
499502
pub mod diff {
500503
use gix::bstr::BString;
501504

502-
/// Print all changes between two objects
505+
/// Print all changes between two objects.
503506
#[derive(Debug, clap::Parser)]
504507
pub struct Platform {
505508
#[clap(subcommand)]
@@ -532,7 +535,7 @@ pub mod diff {
532535
pub mod log {
533536
use gix::bstr::BString;
534537

535-
/// List all commits in a repository, optionally limited to those that change a given path
538+
/// List all commits in a repository, optionally limited to those that change a given path.
536539
#[derive(Debug, clap::Parser)]
537540
pub struct Platform {
538541
/// The git path specification to show a log for.
@@ -544,7 +547,7 @@ pub mod log {
544547
pub mod config {
545548
use gix::bstr::BString;
546549

547-
/// Print all entries in a configuration file or access other sub-commands
550+
/// Print all entries in a configuration file or access other sub-commands.
548551
#[derive(Debug, clap::Parser)]
549552
#[clap(subcommand_required(false))]
550553
pub struct Platform {
@@ -942,7 +945,7 @@ pub mod credential {
942945
pub mod commitgraph {
943946
#[derive(Debug, clap::Subcommand)]
944947
pub enum Subcommands {
945-
/// Verify the integrity of a commit graph file
948+
/// Verify the integrity of a commit graph file.
946949
Verify {
947950
/// output statistical information about the graph.
948951
#[clap(long, short = 's')]
@@ -975,7 +978,7 @@ pub mod revision {
975978
Git,
976979
/// The version that would be checked out into the worktree, including filters.
977980
Worktree,
978-
/// The version that would be diffed (Worktree + Text-Conversion)
981+
/// The version that would be diffed (Worktree + Text-Conversion).
979982
Diff,
980983
/// The version that would be diffed if there is a text-conversion, or the one stored in Git otherwise.
981984
DiffOrGit,
@@ -1037,10 +1040,10 @@ pub mod attributes {
10371040

10381041
#[derive(Debug, clap::Subcommand)]
10391042
pub enum Subcommands {
1040-
/// Run `git check-attr` and `git check-ignore` on all files of the index or all files passed via stdin and validate that
1041-
/// we get the same outcome when computing attributes.
1043+
/// Run `git check-attr` and `git check-ignore` on all files of the index or all files
1044+
/// passed via stdin and validate that we get the same outcome when computing attributes.
10421045
ValidateBaseline {
1043-
/// Print various statistics to stderr
1046+
/// Print various statistics to stderr.
10441047
#[clap(long, short = 's')]
10451048
statistics: bool,
10461049
/// Don't validated excludes as obtaining them with `check-ignore` can be very slow.
@@ -1049,10 +1052,10 @@ pub mod attributes {
10491052
},
10501053
/// List all attributes of the given path-specs and display the result similar to `git check-attr`.
10511054
Query {
1052-
/// Print various statistics to stderr
1055+
/// Print various statistics to stderr.
10531056
#[clap(long, short = 's')]
10541057
statistics: bool,
1055-
/// The git path specifications to list attributes for, or unset to read from stdin one per line.
1058+
/// The Git path specifications to list attributes for, or unset to read from stdin one per line.
10561059
#[clap(value_parser = CheckPathSpec)]
10571060
pathspec: Vec<BString>,
10581061
},
@@ -1069,7 +1072,7 @@ pub mod exclude {
10691072
pub enum Subcommands {
10701073
/// Check if path-specs are excluded and print the result similar to `git check-ignore`.
10711074
Query {
1072-
/// Print various statistics to stderr
1075+
/// Print various statistics to stderr.
10731076
#[clap(long, short = 's')]
10741077
statistics: bool,
10751078
/// Show actual ignore patterns instead of un-excluding an entry.
@@ -1108,7 +1111,7 @@ pub mod index {
11081111

11091112
#[derive(Debug, clap::Subcommand)]
11101113
pub enum Subcommands {
1111-
/// Print all entries to standard output
1114+
/// Print all entries to standard output.
11121115
Entries {
11131116
/// How to output index entries.
11141117
#[clap(long, short = 'f', default_value = "simple", value_enum)]
@@ -1124,7 +1127,7 @@ pub mod index {
11241127
/// Display submodule entries as well if their repository exists.
11251128
#[clap(long, short = 'r')]
11261129
recurse_submodules: bool,
1127-
/// Print various statistics to stderr
1130+
/// Print various statistics to stderr.
11281131
#[clap(long, short = 's')]
11291132
statistics: bool,
11301133
/// The git path specifications to match entries to print.
@@ -1138,8 +1141,10 @@ pub mod index {
11381141
#[clap(long, short = 'f')]
11391142
force: bool,
11401143
/// Path to the index file to be written.
1141-
/// If none is given it will be kept in memory only as a way to measure performance. One day we will probably write the index
1142-
/// back by default, but that requires us to write more of the index to work.
1144+
///
1145+
/// If none is given it will be kept in memory only as a way to measure performance.
1146+
/// One day we will probably write the index back by default, but that requires us to
1147+
/// write more of the index to work.
11431148
#[clap(long, short = 'i')]
11441149
index_output_path: Option<PathBuf>,
11451150
/// Don't write the trailing hash for a performance gain.
@@ -1160,7 +1165,7 @@ pub mod submodule {
11601165

11611166
#[derive(Debug, clap::Subcommand)]
11621167
pub enum Subcommands {
1163-
/// Print all direct submodules to standard output
1168+
/// Print all direct submodules to standard output.
11641169
List {
11651170
/// Set the suffix to append if the repository is dirty (not counting untracked files).
11661171
#[clap(short = 'd', long)]

src/porcelain/options.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ use std::path::PathBuf;
55
#[clap(name = "ein", about = "The rusty git", version = option_env!("GIX_VERSION"))]
66
#[clap(subcommand_required = true)]
77
pub struct Args {
8-
/// Do not display verbose messages and progress information
8+
/// Do not display verbose messages and progress information.
99
#[clap(long, short = 'q')]
1010
pub quiet: bool,
1111

12-
/// Bring up a terminal user interface displaying progress visually
12+
/// Bring up a terminal user interface displaying progress visually.
1313
#[clap(long, conflicts_with("quiet"))]
1414
pub progress: bool,
1515
/// The amount of threads to use. If unset, use all cores, if 0 use al physical cores.
@@ -36,8 +36,8 @@ pub enum Subcommands {
3636
/// Defaults to the current working directory.
3737
directory: Option<PathBuf>,
3838
},
39+
/// A selection of useful tools.
3940
#[cfg(feature = "gitoxide-core-tools")]
40-
/// A selection of useful tools
4141
#[clap(subcommand)]
4242
Tool(ToolCommands),
4343
/// Generate shell completions to stdout or a directory.
@@ -49,6 +49,7 @@ pub enum Subcommands {
4949
/// The output directory in case multiple files are generated. If not provided, will write to stdout.
5050
out_dir: Option<String>,
5151
},
52+
/// Panic immediately, to test panic behavior.
5253
#[cfg(debug_assertions)]
5354
Panic,
5455
}
@@ -117,7 +118,7 @@ pub mod tools {
117118
/// This is an expensive option, and typically cuts speed in half.
118119
#[arg(long, short = 'C')]
119120
pub find_copies_harder: bool,
120-
/// path to the git repository to generate the database for
121+
/// Path to the Git repository to generate the database for.
121122
#[arg(default_value = ".")]
122123
pub repo_dir: std::path::PathBuf,
123124
#[clap(subcommand)]

0 commit comments

Comments
 (0)