summaryrefslogtreecommitdiff
path: root/lib/gitano/command.lua
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2012-10-09 13:48:34 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2012-10-09 13:48:34 +0100
commitbbebd5eee0ec798820b28fa3789fd6cc1e6f6eb4 (patch)
treecd619dc0da67f48f7677fbb997aa893dadc70f81 /lib/gitano/command.lua
parent56d1e0c06732fd08ccb31addc3a6cddc8d29d1d2 (diff)
downloadgitano-bbebd5eee0ec798820b28fa3789fd6cc1e6f6eb4.tar.gz
Add --verbose support to the ls command
Diffstat (limited to 'lib/gitano/command.lua')
-rw-r--r--lib/gitano/command.lua20
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/gitano/command.lua b/lib/gitano/command.lua
index bc6ce26..bb692bb 100644
--- a/lib/gitano/command.lua
+++ b/lib/gitano/command.lua
@@ -791,11 +791,13 @@ assert(register_cmd("rename", builtin_rename_short, builtin_rename_helptext,
local builtin_ls_short = "List repositories on the server"
local builtin_ls_helptext = [[
-usage: ls [<pattern>...]
+usage: ls [--verbose|-v] [<pattern>...]
List repositories on the server. If you do not provide a pattern then all
repositories are considered, otherwise only ones which match the given patterns
-will be considered.
+will be considered. If you specify --verbose then the head ref name and the
+description will be provided in addition to the access rights and repository
+name, separated by tabs.
Patterns are a type of extended glob style syntax:
@@ -835,7 +837,11 @@ end
local function builtin_ls_run(config, _, cmdline, env)
-- Step one, parse each pattern into a lua pattern
local pats = {}
- for i = 2, #cmdline do
+ local firstpat, verbose = 2, false
+ if cmdline[firstpat] == "--verbose" or cmdline[firstpat] == "-v" then
+ firstpat, verbose = 3, true
+ end
+ for i = firstpat, #cmdline do
local pat, c, input = "", "", cmdline[i]
local escaping, star, used_evil = false, false, false
c, input = input:match("^(.)(.*)$")
@@ -913,7 +919,13 @@ local function builtin_ls_run(config, _, cmdline, env)
ctx = util.deep_copy(_ctx)
ctx.operation = "write"
action, reason = repo:run_lace(ctx)
- log.stdout(action == "allow" and "RW" or "R ", repo.name)
+ local tail = ""
+ if verbose then
+ local desc = repo:conf_get("project.description")
+ desc = desc:gsub("\n.*", "")
+ tail = " " .. repo:conf_get("project.head") .. " " .. desc
+ end
+ log.stdout(action == "allow" and "RW" or "R ", repo.name .. tail)
end
end
end