diff options
author | Derrick Stolee <dstolee@microsoft.com> | 2021-12-03 16:34:22 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-12-05 08:52:23 +0300 |
commit | 2b7104573ce237398131562c465d838c018d5880 (patch) | |
tree | 6004e44b4fc7df1b732c19df953eedf2e8f2926b /contrib | |
parent | f5f0842d0b53cfd9e1dd0707f230b4fe1af12720 (diff) |
scalar: implement 'scalar list'
The produced list simply consists of those repositories registered under
the multi-valued `scalar.repo` config setting in the user's Git config.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/scalar/scalar.c | 11 | ||||
-rw-r--r-- | contrib/scalar/scalar.txt | 11 |
2 files changed, 21 insertions, 1 deletions
diff --git a/contrib/scalar/scalar.c b/contrib/scalar/scalar.c index ec783e72ef..65da885c5a 100644 --- a/contrib/scalar/scalar.c +++ b/contrib/scalar/scalar.c @@ -251,6 +251,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[] = { @@ -337,6 +347,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 d9a7998449..f93e3d00ef 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,19 @@ 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:: + List enlistments that are currently registered by Scalar. This + subcommand does not need to be run inside an enlistment. + Register ~~~~~~~~ |