Message ID | fb7c931ddb3a248542bc6a03d09189e937315d0c.1630691688.git.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Upstreaming the Scalar command | expand |
On 04/09/21 00.54, Derrick Stolee via GitGitGadget wrote: > +List > +~~~~ > + > +list:: > + To see which repositories are currently registered by the service, run > + `scalar list`. This subcommand does not need to be run inside a Scalar > + enlistment. > + I think the man-page-style wording should be: > list:: > List enlistments that are currently registered by Scalar. This > subcommand does not need to be run inside an enlistment.
Hi Bagas, On Sat, 4 Sep 2021, Bagas Sanjaya wrote: > On 04/09/21 00.54, Derrick Stolee via GitGitGadget wrote: > > +List > > +~~~~ > > + > > +list:: > > + To see which repositories are currently registered by the service, run > > + `scalar list`. This subcommand does not need to be run inside a Scalar > > + enlistment. > > + > > I think the man-page-style wording should be: > > > list:: > > List enlistments that are currently registered by Scalar. This > > subcommand does not need to be run inside an enlistment. Thank you, I adopted that wording. Ciao, Dscho
diff --git a/contrib/scalar/scalar.c b/contrib/scalar/scalar.c index d114c038b64..7f5436399da 100644 --- a/contrib/scalar/scalar.c +++ b/contrib/scalar/scalar.c @@ -257,6 +257,16 @@ static int unregister_dir(void) return res; } +static int cmd_list(int argc, const char **argv) +{ + if (argc != 1) + die(_("`scalar list` does not take arguments")); + + if (run_git("config", "--global", "--get-all", "scalar.repo", NULL) < 0) + return -1; + return 0; +} + static int cmd_register(int argc, const char **argv) { struct option options[] = { @@ -343,6 +353,7 @@ static struct { const char *name; int (*fn)(int, const char **); } builtins[] = { + { "list", cmd_list }, { "register", cmd_register }, { "unregister", cmd_unregister }, { NULL, NULL}, diff --git a/contrib/scalar/scalar.txt b/contrib/scalar/scalar.txt index d9a79984492..f2528557a0c 100644 --- a/contrib/scalar/scalar.txt +++ b/contrib/scalar/scalar.txt @@ -8,6 +8,7 @@ scalar - an opinionated repository management tool SYNOPSIS -------- [verse] +scalar list scalar register [<enlistment>] scalar unregister [<enlistment>] @@ -28,11 +29,20 @@ an existing Git worktree with Scalar whose name is not `src`, the enlistment will be identical to the worktree. The `scalar` command implements various subcommands, and different options -depending on the subcommand. +depending on the subcommand. With the exception of `list`, all subcommands +expect to be run in an enlistment. COMMANDS -------- +List +~~~~ + +list:: + To see which repositories are currently registered by the service, run + `scalar list`. This subcommand does not need to be run inside a Scalar + enlistment. + Register ~~~~~~~~