mirror of
https://github.com/MichaelMure/git-bug.git
synced 2024-12-15 02:01:43 +03:00
Merge pull request #883 from MichaelMure/refactor-863-merge-ls-id-into-ls
refactor(863): merge ls-id into ls
This commit is contained in:
commit
8364cb221b
@ -14,6 +14,13 @@ func newLsIdCommand() *cobra.Command {
|
|||||||
RunE: closeBackend(env, func(cmd *cobra.Command, args []string) error {
|
RunE: closeBackend(env, func(cmd *cobra.Command, args []string) error {
|
||||||
return runLsId(env, args)
|
return runLsId(env, args)
|
||||||
}),
|
}),
|
||||||
|
Deprecated: `and will be removed in v1.0.
|
||||||
|
|
||||||
|
Please use the "ls" command which allows filtering and sorting of the resulting
|
||||||
|
list of ids. The following example would print a new-line separated list containing
|
||||||
|
the ids of all open bugs:
|
||||||
|
git-bug ls --format id --status open
|
||||||
|
`,
|
||||||
}
|
}
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
|
@ -92,9 +92,9 @@ git bug ls status:open --by creation "foo bar" baz
|
|||||||
"Select the sorting direction. Valid values are [asc,desc]")
|
"Select the sorting direction. Valid values are [asc,desc]")
|
||||||
cmd.RegisterFlagCompletionFunc("direction", completeFrom([]string{"asc", "desc"}))
|
cmd.RegisterFlagCompletionFunc("direction", completeFrom([]string{"asc", "desc"}))
|
||||||
flags.StringVarP(&options.outputFormat, "format", "f", "default",
|
flags.StringVarP(&options.outputFormat, "format", "f", "default",
|
||||||
"Select the output formatting style. Valid values are [default,plain,compact,json,org-mode]")
|
"Select the output formatting style. Valid values are [default,plain,compact,id,json,org-mode]")
|
||||||
cmd.RegisterFlagCompletionFunc("format",
|
cmd.RegisterFlagCompletionFunc("format",
|
||||||
completeFrom([]string{"default", "plain", "compact", "json", "org-mode"}))
|
completeFrom([]string{"default", "plain", "compact", "id", "json", "org-mode"}))
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
@ -143,6 +143,8 @@ func runLs(env *Env, opts lsOptions, args []string) error {
|
|||||||
return lsJsonFormatter(env, bugExcerpt)
|
return lsJsonFormatter(env, bugExcerpt)
|
||||||
case "compact":
|
case "compact":
|
||||||
return lsCompactFormatter(env, bugExcerpt)
|
return lsCompactFormatter(env, bugExcerpt)
|
||||||
|
case "id":
|
||||||
|
return lsIDFormatter(env, bugExcerpt)
|
||||||
case "default":
|
case "default":
|
||||||
return lsDefaultFormatter(env, bugExcerpt)
|
return lsDefaultFormatter(env, bugExcerpt)
|
||||||
default:
|
default:
|
||||||
@ -252,6 +254,14 @@ func lsCompactFormatter(env *Env, bugExcerpts []*cache.BugExcerpt) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func lsIDFormatter(env *Env, bugExcerpts []*cache.BugExcerpt) error {
|
||||||
|
for _, b := range bugExcerpts {
|
||||||
|
env.out.Println(b.Id.String())
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func lsDefaultFormatter(env *Env, bugExcerpts []*cache.BugExcerpt) error {
|
func lsDefaultFormatter(env *Env, bugExcerpts []*cache.BugExcerpt) error {
|
||||||
for _, b := range bugExcerpts {
|
for _, b := range bugExcerpts {
|
||||||
author, err := env.backend.ResolveIdentityExcerpt(b.AuthorId)
|
author, err := env.backend.ResolveIdentityExcerpt(b.AuthorId)
|
||||||
|
@ -61,6 +61,7 @@ $`
|
|||||||
{"default", "^[0-9a-f]{7}\topen\tthis is a bug title \tJohn Doe \t\n$"},
|
{"default", "^[0-9a-f]{7}\topen\tthis is a bug title \tJohn Doe \t\n$"},
|
||||||
{"plain", "^[0-9a-f]{7} \\[open\\] this is a bug title\n$"},
|
{"plain", "^[0-9a-f]{7} \\[open\\] this is a bug title\n$"},
|
||||||
{"compact", "^[0-9a-f]{7} open this is a bug title John Doe\n$"},
|
{"compact", "^[0-9a-f]{7} open this is a bug title John Doe\n$"},
|
||||||
|
{"id", "^[0-9a-f]{64}\n$"},
|
||||||
{"org-mode", expOrgMode},
|
{"org-mode", expOrgMode},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
.nh
|
|
||||||
.TH "GIT-BUG" "1" "Apr 2019" "Generated from git-bug's source code" ""
|
|
||||||
|
|
||||||
.SH NAME
|
|
||||||
.PP
|
|
||||||
git-bug-ls-id - List bug identifiers.
|
|
||||||
|
|
||||||
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.PP
|
|
||||||
\fBgit-bug ls-id [PREFIX] [flags]\fP
|
|
||||||
|
|
||||||
|
|
||||||
.SH DESCRIPTION
|
|
||||||
.PP
|
|
||||||
List bug identifiers.
|
|
||||||
|
|
||||||
|
|
||||||
.SH OPTIONS
|
|
||||||
.PP
|
|
||||||
\fB-h\fP, \fB--help\fP[=false]
|
|
||||||
help for ls-id
|
|
||||||
|
|
||||||
|
|
||||||
.SH SEE ALSO
|
|
||||||
.PP
|
|
||||||
\fBgit-bug(1)\fP
|
|
@ -62,7 +62,7 @@ You can pass an additional query to filter and order the list. This query can be
|
|||||||
|
|
||||||
.PP
|
.PP
|
||||||
\fB-f\fP, \fB--format\fP="default"
|
\fB-f\fP, \fB--format\fP="default"
|
||||||
Select the output formatting style. Valid values are [default,plain,compact,json,org-mode]
|
Select the output formatting style. Valid values are [default,plain,compact,id,json,org-mode]
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
\fB-h\fP, \fB--help\fP[=false]
|
\fB-h\fP, \fB--help\fP[=false]
|
||||||
|
@ -29,4 +29,4 @@ the same git remote you are already using to collaborate with other people.
|
|||||||
|
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.PP
|
.PP
|
||||||
\fBgit-bug-add(1)\fP, \fBgit-bug-bridge(1)\fP, \fBgit-bug-commands(1)\fP, \fBgit-bug-comment(1)\fP, \fBgit-bug-deselect(1)\fP, \fBgit-bug-label(1)\fP, \fBgit-bug-ls(1)\fP, \fBgit-bug-ls-id(1)\fP, \fBgit-bug-ls-label(1)\fP, \fBgit-bug-pull(1)\fP, \fBgit-bug-push(1)\fP, \fBgit-bug-rm(1)\fP, \fBgit-bug-select(1)\fP, \fBgit-bug-show(1)\fP, \fBgit-bug-status(1)\fP, \fBgit-bug-termui(1)\fP, \fBgit-bug-title(1)\fP, \fBgit-bug-user(1)\fP, \fBgit-bug-version(1)\fP, \fBgit-bug-webui(1)\fP
|
\fBgit-bug-add(1)\fP, \fBgit-bug-bridge(1)\fP, \fBgit-bug-commands(1)\fP, \fBgit-bug-comment(1)\fP, \fBgit-bug-deselect(1)\fP, \fBgit-bug-label(1)\fP, \fBgit-bug-ls(1)\fP, \fBgit-bug-ls-label(1)\fP, \fBgit-bug-pull(1)\fP, \fBgit-bug-push(1)\fP, \fBgit-bug-rm(1)\fP, \fBgit-bug-select(1)\fP, \fBgit-bug-show(1)\fP, \fBgit-bug-status(1)\fP, \fBgit-bug-termui(1)\fP, \fBgit-bug-title(1)\fP, \fBgit-bug-user(1)\fP, \fBgit-bug-version(1)\fP, \fBgit-bug-webui(1)\fP
|
||||||
|
@ -31,7 +31,6 @@ git-bug [flags]
|
|||||||
* [git-bug deselect](git-bug_deselect.md) - Clear the implicitly selected bug.
|
* [git-bug deselect](git-bug_deselect.md) - Clear the implicitly selected bug.
|
||||||
* [git-bug label](git-bug_label.md) - Display, add or remove labels to/from a bug.
|
* [git-bug label](git-bug_label.md) - Display, add or remove labels to/from a bug.
|
||||||
* [git-bug ls](git-bug_ls.md) - List bugs.
|
* [git-bug ls](git-bug_ls.md) - List bugs.
|
||||||
* [git-bug ls-id](git-bug_ls-id.md) - List bug identifiers.
|
|
||||||
* [git-bug ls-label](git-bug_ls-label.md) - List valid labels.
|
* [git-bug ls-label](git-bug_ls-label.md) - List valid labels.
|
||||||
* [git-bug pull](git-bug_pull.md) - Pull bugs update from a git remote.
|
* [git-bug pull](git-bug_pull.md) - Pull bugs update from a git remote.
|
||||||
* [git-bug push](git-bug_push.md) - Push bugs update to a git remote.
|
* [git-bug push](git-bug_push.md) - Push bugs update to a git remote.
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
## git-bug ls-id
|
|
||||||
|
|
||||||
List bug identifiers.
|
|
||||||
|
|
||||||
```
|
|
||||||
git-bug ls-id [PREFIX] [flags]
|
|
||||||
```
|
|
||||||
|
|
||||||
### Options
|
|
||||||
|
|
||||||
```
|
|
||||||
-h, --help help for ls-id
|
|
||||||
```
|
|
||||||
|
|
||||||
### SEE ALSO
|
|
||||||
|
|
||||||
* [git-bug](git-bug.md) - A bug tracker embedded in Git.
|
|
||||||
|
|
@ -42,7 +42,7 @@ git bug ls status:open --by creation "foo bar" baz
|
|||||||
-n, --no strings Filter by absence of something. Valid values are [label]
|
-n, --no strings Filter by absence of something. Valid values are [label]
|
||||||
-b, --by string Sort the results by a characteristic. Valid values are [id,creation,edit] (default "creation")
|
-b, --by string Sort the results by a characteristic. Valid values are [id,creation,edit] (default "creation")
|
||||||
-d, --direction string Select the sorting direction. Valid values are [asc,desc] (default "asc")
|
-d, --direction string Select the sorting direction. Valid values are [asc,desc] (default "asc")
|
||||||
-f, --format string Select the output formatting style. Valid values are [default,plain,compact,json,org-mode] (default "default")
|
-f, --format string Select the output formatting style. Valid values are [default,plain,compact,id,json,org-mode] (default "default")
|
||||||
-h, --help help for ls
|
-h, --help help for ls
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user