Skip to content

Commit 6a7687b

Browse files
committed
Various docs improvements
1 parent 162a89a commit 6a7687b

10 files changed

Lines changed: 40 additions & 35 deletions

‎src/main.cpp‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ int main(int argc, char** argv)
4242
auto version = app.add_flag("-v,--version", "Show version");
4343

4444
// Sub commands
45-
init_subcommand init(lg2_obj, app);
46-
status_subcommand status(lg2_obj, app);
4745
add_subcommand add(lg2_obj, app);
4846
branch_subcommand branch(lg2_obj, app);
4947
checkout_subcommand checkout(lg2_obj, app);
@@ -52,19 +50,21 @@ int main(int argc, char** argv)
5250
config_subcommand config(lg2_obj, app);
5351
diff_subcommand diff(lg2_obj, app);
5452
fetch_subcommand fetch(lg2_obj, app);
55-
reset_subcommand reset(lg2_obj, app);
53+
init_subcommand init(lg2_obj, app);
5654
log_subcommand log(lg2_obj, app);
5755
merge_subcommand merge(lg2_obj, app);
5856
mv_subcommand mv(lg2_obj, app);
5957
push_subcommand push(lg2_obj, app);
6058
rebase_subcommand rebase(lg2_obj, app);
6159
remote_subcommand remote(lg2_obj, app);
60+
reset_subcommand reset(lg2_obj, app);
6261
revlist_subcommand revlist(lg2_obj, app);
6362
revparse_subcommand revparse(lg2_obj, app);
6463
rm_subcommand rm(lg2_obj, app);
64+
showref_subcommand showref(lg2_obj, app);
6565
stash_subcommand stash(lg2_obj, app);
66+
status_subcommand status(lg2_obj, app);
6667
tag_subcommand tag(lg2_obj, app);
67-
showref_subcommand showref(lg2_obj, app);
6868

6969
app.require_subcommand(/* min */ 0, /* max */ 1);
7070

‎src/subcommand/clone_subcommand.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
clone_subcommand::clone_subcommand(const libgit2_object&, CLI::App& app)
1212
{
13-
auto* sub = app.add_subcommand("clone", "Clone a directory into a new repository");
13+
auto* sub = app.add_subcommand("clone", "Clone a repository into a new directory");
1414

1515
sub->add_option("<repository>", m_repository, "The (possibly remote) repository to clone from.")->required();
1616
sub->add_option("<directory>", m_directory, "The name of a new directory to clone into.");

‎src/subcommand/config_subcommand.cpp‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ config_subcommand::config_subcommand(const libgit2_object&, CLI::App& app)
2727
"Unset value for one or more config options. By default, this command refuses to unset multi-valued keys. Passing --all will unset all multi-valued config options, whereas --value will unset all config options whose values match the given pattern."
2828
);
2929

30-
get->add_option("<name>", m_name, "");
31-
set->add_option("<name>", m_name, "");
32-
set->add_option("<value>", m_value, "");
33-
unset->add_option("<name>", m_name, "");
30+
get->add_option("<name>", m_name, "Name of the config variable to get, e.g. user.name");
31+
set->add_option("<name>", m_name, "Name of the config variable to set");
32+
set->add_option("<value>", m_value, "Value to set the config variable to");
33+
unset->add_option("<name>", m_name, "Name of the config variable to unset");
3434

3535
// TODO:
3636
// sub->add_flag("--local", m_local_flag, "");

‎src/subcommand/diff_subcommand.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ diff_subcommand::diff_subcommand(const libgit2_object&, CLI::App& app)
1414
{
1515
auto* sub = app.add_subcommand("diff", "Show changes between commits, commit and working tree, etc");
1616

17-
sub->add_option("<files>", m_files, "tree-ish objects to compare")->expected(0, 2);
17+
sub->add_option("<files>", m_files, "Tree-ish objects to compare")->expected(0, 2);
1818

1919
sub->add_flag("--stat", m_stat_flag, "Generate a diffstat");
2020
sub->add_flag("--shortstat", m_shortstat_flag, "Output only the last line of --stat");

‎src/subcommand/fetch_subcommand.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ fetch_subcommand::fetch_subcommand(const libgit2_object&, CLI::App& app)
1515
auto* sub = app.add_subcommand("fetch", "Download objects and refs from another repository");
1616

1717
sub->add_option("<remote>", m_remote_name, "The remote to fetch from")->default_val("origin");
18-
sub->add_option("--depth", m_depth, "deepen or shorten history of shallow clone");
19-
sub->add_option("--deepen", m_deepen, "deepen history of shallow clone");
18+
sub->add_option("--depth", m_depth, "Deepen or shorten history of shallow clone");
19+
sub->add_option("--deepen", m_deepen, "Deepen history of shallow clone");
2020
// sub->add_option("--shallow-since", m_shallow_since, "<time>\ndeepen history of shallow repository based
2121
// on time."); sub->add_option("--shallow-exclude", m_shallow_exclude, "<ref>\ndeepen history of shallow
2222
// clone, excluding ref");
23-
sub->add_flag("--unshallow", m_unshallow, "convert to a complete repository");
23+
sub->add_flag("--unshallow", m_unshallow, "Convert to a complete repository");
2424
// sub->add_flag("--update-shallow", m_update_shallow, "accept refs that update .git/shallow");
2525

2626
sub->callback(

‎src/subcommand/init_subcommand.cpp‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66

77
init_subcommand::init_subcommand(const libgit2_object&, CLI::App& app)
88
{
9-
auto* sub = app.add_subcommand("init", "Explanation of init here");
9+
auto* sub = app.add_subcommand("init", "Create an empty Git repository or reinitialize an existing one");
1010

11-
sub->add_flag("--bare", m_bare, "info about bare arg");
11+
sub->add_flag("--bare", m_bare, "Create a bare repository");
1212

1313
// If directory not specified, uses cwd.
14-
sub->add_option("directory", m_directory, "info about directory arg")
14+
sub->add_option(
15+
"directory",
16+
m_directory,
17+
"Directory to create the repository in, created if it does not exist. Defaults to the current directory."
18+
)
1519
->check(CLI::ExistingDirectory | CLI::NonexistentPath)
1620
->default_val(get_current_git_path());
1721
sub->add_option(

‎src/subcommand/log_subcommand.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
log_subcommand::log_subcommand(const libgit2_object&, CLI::App& app)
1818
{
19-
auto* sub = app.add_subcommand("log", "Shows commit logs");
19+
auto* sub = app.add_subcommand("log", "Show commit logs");
2020

2121
sub->add_option(
2222
"--format",

‎src/subcommand/revlist_subcommand.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ revlist_subcommand::revlist_subcommand(const libgit2_object&, CLI::App& app)
77
{
88
auto* sub = app.add_subcommand("rev-list", "Lists commit objects in reverse chronological order");
99

10-
sub->add_option("<commit>", m_commit, "");
10+
sub->add_option("<commit>", m_commit, "Commit to start listing from (e.g. HEAD, main, dae86e)");
1111
sub->add_option("-n,--max-count", m_max_count_flag, "Limit the output to <number> commits.");
1212

1313
sub->callback(

‎src/subcommand/revparse_subcommand.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
revparse_subcommand::revparse_subcommand(const libgit2_object&, CLI::App& app)
77
{
8-
auto* sub = app.add_subcommand("rev-parse", "Pick out and message parameters");
8+
auto* sub = app.add_subcommand("rev-parse", "Pick out and massage parameters");
99

1010
auto* bare_opt = sub->add_flag(
1111
"--is-bare-repository",

‎src/subcommand/stash_subcommand.cpp‎

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,54 +26,55 @@ bool has_subcommand(CLI::App* cmd)
2626

2727
stash_subcommand::stash_subcommand(const libgit2_object&, CLI::App& app)
2828
{
29-
auto* stash = app.add_subcommand("stash", "Stash the changes in a dirty working directory away\n");
29+
auto* stash = app.add_subcommand("stash", "Stash the changes in a dirty working directory away");
3030
auto* push = stash->add_subcommand(
3131
"push",
32-
"Save your local modifications to a new stash entry and roll them back to " + ansi_code::bold
33-
+ "HEAD " + ansi_code::reset
34-
+ "(in the working tree and in the index). The <message> part is optional and gives the description along with the stashed state.\n"
32+
"Save your local modifications to a new stash entry and roll them back to " + ansi_code::bold + "HEAD"
33+
+ ansi_code::reset
34+
+ " (in the working tree and in the index). The <message> part is optional and gives the description along with the stashed state."
3535
);
3636
auto* list = stash->add_subcommand(
3737
"list",
3838
"List the stash entries that you currently have. Each stash entry is listed with its name (e.g. "
3939
+ ansi_code::bold + "stash@" + ansi_code::reset + "{0} is the latest entry, " + ansi_code::bold
4040
+ "stash@" + ansi_code::reset
41-
+ "{1} is the one before, etc.), the name of the branch that was current when the entry was made, and a short description of the commit the entry was based on.\n"
41+
+ "{1} is the one before, etc.), the name of the branch that was current when the entry was made, and a short description of the commit the entry was based on."
4242
); // TODO: check if shows all of that
4343
auto* pop = stash->add_subcommand(
4444
"pop",
4545
"Remove a single stashed state from the stash list and apply it on top of the current working tree state, i.e., do the inverse operation of "
46-
+ ansi_code::bold + "git stash push" + ansi_code::reset + ".\n"
46+
+ ansi_code::bold + "git stash push" + ansi_code::reset + "."
4747
);
4848
auto* apply = stash->add_subcommand(
4949
"apply",
5050
"Like " + ansi_code::bold + "pop" + ansi_code::reset
5151
+ ", but do not remove the state from the stash list. Unlike " + ansi_code::bold + "pop"
5252
+ ansi_code::reset + ", <stash> may be any commit that looks like a commit created by "
53-
+ ansi_code::bold + "stash push" + ansi_code::reset + " or " + ".\n"
54-
); // TODO: add when "create" is implemented: ansi_code::bold + "stash create" + ansi_code::reset +
53+
+ ansi_code::bold + "stash push" + ansi_code::reset + "."
54+
); // TODO: add when "create" is implemented: " or " + ansi_code::bold + "stash create" +
55+
// ansi_code::reset +
5556
auto* show = stash->add_subcommand(
5657
"show",
57-
"Show the changes recorded in the stash entry as a diff between the stashed contents and the commit back when the stash entry was first created.\n"
58+
"Show the changes recorded in the stash entry as a diff between the stashed contents and the commit back when the stash entry was first created."
5859
);
5960

60-
push->add_option("-m,--message", m_message, "");
61+
push->add_option("-m,--message", m_message, "Description along with the stashed state");
6162
pop->add_option(
6263
"--index",
6364
m_index,
6465
"This option is only valid for " + ansi_code::bold + "pop" + ansi_code::reset + " and "
65-
+ ansi_code::bold + "apply" + ansi_code::reset + " commands.\n"
66+
+ ansi_code::bold + "apply" + ansi_code::reset + " commands."
6667
);
6768
apply->add_option(
6869
"--index",
6970
m_index,
7071
"This option is only valid for " + ansi_code::bold + "pop" + ansi_code::reset + " and "
71-
+ ansi_code::bold + "apply" + ansi_code::reset + " commands.\n"
72+
+ ansi_code::bold + "apply" + ansi_code::reset + " commands."
7273
);
73-
show->add_flag("--stat", m_stat_flag, "Generate a diffstat\n");
74-
show->add_flag("--shortstat", m_shortstat_flag, "Output only the last line of --stat\n");
75-
show->add_flag("--numstat", m_numstat_flag, "Machine-friendly --stat\n");
76-
show->add_flag("--summary", m_summary_flag, "Output a condensed summary\n");
74+
show->add_flag("--stat", m_stat_flag, "Generate a diffstat");
75+
show->add_flag("--shortstat", m_shortstat_flag, "Output only the last line of --stat");
76+
show->add_flag("--numstat", m_numstat_flag, "Machine-friendly --stat");
77+
show->add_flag("--summary", m_summary_flag, "Output a condensed summary");
7778

7879
stash->callback(
7980
[this, stash]()

0 commit comments

Comments
 (0)