Skip to content

Commit c5dbf20

Browse files
CGA1123mislav
andauthored
Alias list as ls for all commands (cli#5214)
I always get tripped up whenever trying to list my codespaces, adding `ls` as an alias to `list` feels natural enough. Co-authored-by: Mislav Marohnić <mislav@github.com>
1 parent c2a9c5a commit c5dbf20

File tree

14 files changed

+50
-36
lines changed

14 files changed

+50
-36
lines changed

pkg/cmd/alias/list/list.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
2424
}
2525

2626
cmd := &cobra.Command{
27-
Use: "list",
28-
Short: "List your aliases",
27+
Use: "list",
28+
Short: "List your aliases",
29+
Aliases: []string{"ls"},
2930
Long: heredoc.Doc(`
3031
This command prints out all of the aliases gh is configured to use.
3132
`),

pkg/cmd/codespace/list.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ func newListCmd(app *App) *cobra.Command {
1616
var exporter cmdutil.Exporter
1717

1818
listCmd := &cobra.Command{
19-
Use: "list",
20-
Short: "List your codespaces",
21-
Args: noArgsConstraint,
19+
Use: "list",
20+
Short: "List your codespaces",
21+
Aliases: []string{"ls"},
22+
Args: noArgsConstraint,
2223
RunE: func(cmd *cobra.Command, args []string) error {
2324
if limit < 1 {
2425
return cmdutil.FlagErrorf("invalid limit: %v", limit)

pkg/cmd/config/list/list.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ func NewCmdConfigList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.
2323
}
2424

2525
cmd := &cobra.Command{
26-
Use: "list",
27-
Short: "Print a list of configuration keys and values",
28-
Args: cobra.ExactArgs(0),
26+
Use: "list",
27+
Short: "Print a list of configuration keys and values",
28+
Aliases: []string{"ls"},
29+
Args: cobra.ExactArgs(0),
2930
RunE: func(cmd *cobra.Command, args []string) error {
3031
if runF != nil {
3132
return runF(opts)

pkg/cmd/extension/command.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ func NewCmdExtension(f *cmdutil.Factory) *cobra.Command {
4040

4141
extCmd.AddCommand(
4242
&cobra.Command{
43-
Use: "list",
44-
Short: "List installed extension commands",
45-
Args: cobra.NoArgs,
43+
Use: "list",
44+
Short: "List installed extension commands",
45+
Aliases: []string{"ls"},
46+
Args: cobra.NoArgs,
4647
RunE: func(cmd *cobra.Command, args []string) error {
4748
cmds := m.List(true)
4849
if len(cmds) == 0 {

pkg/cmd/gist/list/list.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
3535
var flagSecret bool
3636

3737
cmd := &cobra.Command{
38-
Use: "list",
39-
Short: "List your gists",
40-
Args: cobra.NoArgs,
38+
Use: "list",
39+
Short: "List your gists",
40+
Aliases: []string{"ls"},
41+
Args: cobra.NoArgs,
4142
RunE: func(cmd *cobra.Command, args []string) error {
4243
if opts.Limit < 1 {
4344
return cmdutil.FlagErrorf("invalid limit: %v", opts.Limit)

pkg/cmd/gpg-key/list/list.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
2727
}
2828

2929
cmd := &cobra.Command{
30-
Use: "list",
31-
Short: "Lists GPG keys in your GitHub account",
32-
Args: cobra.ExactArgs(0),
30+
Use: "list",
31+
Short: "Lists GPG keys in your GitHub account",
32+
Aliases: []string{"ls"},
33+
Args: cobra.ExactArgs(0),
3334
RunE: func(cmd *cobra.Command, args []string) error {
3435
if runF != nil {
3536
return runF(opts)

pkg/cmd/issue/list/list.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
6666
$ gh issue list --milestone "The big 1.0"
6767
$ gh issue list --search "error no:assignee sort:created-asc"
6868
`),
69-
Args: cmdutil.NoArgsQuoteReminder,
69+
Aliases: []string{"ls"},
70+
Args: cmdutil.NoArgsQuoteReminder,
7071
RunE: func(cmd *cobra.Command, args []string) error {
7172
// support `-R, --repo` override
7273
opts.BaseRepo = f.BaseRepo

pkg/cmd/pr/list/list.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
7070
Open the list of PRs in a web browser
7171
$ gh pr list --web
7272
`),
73-
Args: cmdutil.NoArgsQuoteReminder,
73+
Aliases: []string{"ls"},
74+
Args: cmdutil.NoArgsQuoteReminder,
7475
RunE: func(cmd *cobra.Command, args []string) error {
7576
// support `-R, --repo` override
7677
opts.BaseRepo = f.BaseRepo

pkg/cmd/release/list/list.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
2828
}
2929

3030
cmd := &cobra.Command{
31-
Use: "list",
32-
Short: "List releases in a repository",
33-
Args: cobra.NoArgs,
31+
Use: "list",
32+
Short: "List releases in a repository",
33+
Aliases: []string{"ls"},
34+
Args: cobra.NoArgs,
3435
RunE: func(cmd *cobra.Command, args []string) error {
3536
// support `-R, --repo` override
3637
opts.BaseRepo = f.BaseRepo

pkg/cmd/repo/deploy-key/list/list.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
2626
}
2727

2828
cmd := &cobra.Command{
29-
Use: "list",
30-
Short: "List deploy keys in a GitHub repository",
31-
Args: cobra.ExactArgs(0),
29+
Use: "list",
30+
Short: "List deploy keys in a GitHub repository",
31+
Aliases: []string{"ls"},
32+
Args: cobra.ExactArgs(0),
3233
RunE: func(cmd *cobra.Command, args []string) error {
3334
opts.BaseRepo = f.BaseRepo
3435

0 commit comments

Comments
 (0)