Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ int main(int argc, char** argv)
auto version = app.add_flag("-v,--version", "Show version");

// Sub commands
init_subcommand init(lg2_obj, app);
status_subcommand status(lg2_obj, app);
add_subcommand add(lg2_obj, app);
branch_subcommand branch(lg2_obj, app);
checkout_subcommand checkout(lg2_obj, app);
Expand All @@ -52,19 +50,21 @@ int main(int argc, char** argv)
config_subcommand config(lg2_obj, app);
diff_subcommand diff(lg2_obj, app);
fetch_subcommand fetch(lg2_obj, app);
reset_subcommand reset(lg2_obj, app);
init_subcommand init(lg2_obj, app);
log_subcommand log(lg2_obj, app);
merge_subcommand merge(lg2_obj, app);
mv_subcommand mv(lg2_obj, app);
push_subcommand push(lg2_obj, app);
rebase_subcommand rebase(lg2_obj, app);
remote_subcommand remote(lg2_obj, app);
reset_subcommand reset(lg2_obj, app);
revlist_subcommand revlist(lg2_obj, app);
revparse_subcommand revparse(lg2_obj, app);
rm_subcommand rm(lg2_obj, app);
showref_subcommand showref(lg2_obj, app);
stash_subcommand stash(lg2_obj, app);
status_subcommand status(lg2_obj, app);
tag_subcommand tag(lg2_obj, app);
showref_subcommand showref(lg2_obj, app);

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

Expand Down
2 changes: 1 addition & 1 deletion src/subcommand/clone_subcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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

sub->add_option("<repository>", m_repository, "The (possibly remote) repository to clone from.")->required();
sub->add_option("<directory>", m_directory, "The name of a new directory to clone into.");
Expand Down
8 changes: 4 additions & 4 deletions src/subcommand/config_subcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ config_subcommand::config_subcommand(const libgit2_object&, CLI::App& app)
"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."
);

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

// TODO:
// sub->add_flag("--local", m_local_flag, "");
Expand Down
2 changes: 1 addition & 1 deletion src/subcommand/diff_subcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ diff_subcommand::diff_subcommand(const libgit2_object&, CLI::App& app)
{
auto* sub = app.add_subcommand("diff", "Show changes between commits, commit and working tree, etc");

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

sub->add_flag("--stat", m_stat_flag, "Generate a diffstat");
sub->add_flag("--shortstat", m_shortstat_flag, "Output only the last line of --stat");
Expand Down
6 changes: 3 additions & 3 deletions src/subcommand/fetch_subcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ fetch_subcommand::fetch_subcommand(const libgit2_object&, CLI::App& app)
auto* sub = app.add_subcommand("fetch", "Download objects and refs from another repository");

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

sub->callback(
Expand Down
10 changes: 7 additions & 3 deletions src/subcommand/init_subcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@

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

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

// If directory not specified, uses cwd.
sub->add_option("directory", m_directory, "info about directory arg")
sub->add_option(
"directory",
m_directory,
"Directory to create the repository in, created if it does not exist. Defaults to the current directory."
)
->check(CLI::ExistingDirectory | CLI::NonexistentPath)
->default_val(get_current_git_path());
sub->add_option(
Expand Down
2 changes: 1 addition & 1 deletion src/subcommand/log_subcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

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

sub->add_option(
"--format",
Expand Down
2 changes: 1 addition & 1 deletion src/subcommand/revlist_subcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ revlist_subcommand::revlist_subcommand(const libgit2_object&, CLI::App& app)
{
auto* sub = app.add_subcommand("rev-list", "Lists commit objects in reverse chronological order");

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

sub->callback(
Expand Down
2 changes: 1 addition & 1 deletion src/subcommand/revparse_subcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

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

auto* bare_opt = sub->add_flag(
"--is-bare-repository",
Expand Down
33 changes: 17 additions & 16 deletions src/subcommand/stash_subcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,54 +26,55 @@ bool has_subcommand(CLI::App* cmd)

stash_subcommand::stash_subcommand(const libgit2_object&, CLI::App& app)
{
auto* stash = app.add_subcommand("stash", "Stash the changes in a dirty working directory away\n");
auto* stash = app.add_subcommand("stash", "Stash the changes in a dirty working directory away");
auto* push = stash->add_subcommand(
"push",
"Save your local modifications to a new stash entry and roll them back to " + ansi_code::bold
+ "HEAD " + ansi_code::reset
+ "(in the working tree and in the index). The <message> part is optional and gives the description along with the stashed state.\n"
"Save your local modifications to a new stash entry and roll them back to " + ansi_code::bold + "HEAD"
+ ansi_code::reset
+ " (in the working tree and in the index). The <message> part is optional and gives the description along with the stashed state."
);
auto* list = stash->add_subcommand(
"list",
"List the stash entries that you currently have. Each stash entry is listed with its name (e.g. "
+ ansi_code::bold + "stash@" + ansi_code::reset + "{0} is the latest entry, " + ansi_code::bold
+ "stash@" + ansi_code::reset
+ "{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"
+ "{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."
); // TODO: check if shows all of that
auto* pop = stash->add_subcommand(
"pop",
"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 "
+ ansi_code::bold + "git stash push" + ansi_code::reset + ".\n"
+ ansi_code::bold + "git stash push" + ansi_code::reset + "."
);
auto* apply = stash->add_subcommand(
"apply",
"Like " + ansi_code::bold + "pop" + ansi_code::reset
+ ", but do not remove the state from the stash list. Unlike " + ansi_code::bold + "pop"
+ ansi_code::reset + ", <stash> may be any commit that looks like a commit created by "
+ ansi_code::bold + "stash push" + ansi_code::reset + " or " + ".\n"
); // TODO: add when "create" is implemented: ansi_code::bold + "stash create" + ansi_code::reset +
+ ansi_code::bold + "stash push" + ansi_code::reset + "."
); // TODO: add when "create" is implemented: " or " + ansi_code::bold + "stash create" +
// ansi_code::reset +
auto* show = stash->add_subcommand(
"show",
"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"
"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."
);

push->add_option("-m,--message", m_message, "");
push->add_option("-m,--message", m_message, "Description along with the stashed state");
pop->add_option(
"--index",
m_index,
"This option is only valid for " + ansi_code::bold + "pop" + ansi_code::reset + " and "
+ ansi_code::bold + "apply" + ansi_code::reset + " commands.\n"
+ ansi_code::bold + "apply" + ansi_code::reset + " commands."
);
apply->add_option(
"--index",
m_index,
"This option is only valid for " + ansi_code::bold + "pop" + ansi_code::reset + " and "
+ ansi_code::bold + "apply" + ansi_code::reset + " commands.\n"
+ ansi_code::bold + "apply" + ansi_code::reset + " commands."
);
show->add_flag("--stat", m_stat_flag, "Generate a diffstat\n");
show->add_flag("--shortstat", m_shortstat_flag, "Output only the last line of --stat\n");
show->add_flag("--numstat", m_numstat_flag, "Machine-friendly --stat\n");
show->add_flag("--summary", m_summary_flag, "Output a condensed summary\n");
show->add_flag("--stat", m_stat_flag, "Generate a diffstat");
show->add_flag("--shortstat", m_shortstat_flag, "Output only the last line of --stat");
show->add_flag("--numstat", m_numstat_flag, "Machine-friendly --stat");
show->add_flag("--summary", m_summary_flag, "Output a condensed summary");

stash->callback(
[this, stash]()
Expand Down
Loading