Skip to content

Commit

Permalink
git: ls-tree
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Aug 13, 2024
1 parent ab5f4d2 commit e54cbb7
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 28 deletions.
47 changes: 47 additions & 0 deletions completers/git_completer/cmd/lsTree.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/git"
"github.com/spf13/cobra"
)

var lsTreeCmd = &cobra.Command{
Use: "ls-tree",
Short: "List the contents of a tree object",
Run: func(cmd *cobra.Command, args []string) {},
GroupID: groups[group_low_level_interrogator].ID,
}

func init() {
carapace.Gen(lsTreeCmd).Standalone()

lsTreeCmd.Flags().String("abbrev", "", "use <n> digits to display object names")
lsTreeCmd.Flags().BoolS("d", "d", false, "only show trees")
lsTreeCmd.Flags().String("format", "", "format to use for the output")
lsTreeCmd.Flags().Bool("full-name", false, "use full path names")
lsTreeCmd.Flags().Bool("full-tree", false, "list entire tree")
lsTreeCmd.Flags().BoolP("long", "l", false, "include object size")
lsTreeCmd.Flags().Bool("name-only", false, "list only filenames")
lsTreeCmd.Flags().Bool("name-status", false, "list only filenames")
lsTreeCmd.Flags().Bool("no-abbrev", false, "do not use abbreviated digits to display object names")
lsTreeCmd.Flags().Bool("no-full-name", false, "do not use full path names")
lsTreeCmd.Flags().Bool("no-full-tree", false, "do not list entire tree")
lsTreeCmd.Flags().Bool("object-only", false, "list only objects")
lsTreeCmd.Flags().BoolS("r", "r", false, "recurse into subtrees")
lsTreeCmd.Flags().BoolS("t", "t", false, "show trees when recursing")
lsTreeCmd.Flags().BoolS("z", "z", false, "terminate entries with NUL byte")
rootCmd.AddCommand(lsTreeCmd)

lsTreeCmd.Flag("abbrev").NoOptDefVal = " "

carapace.Gen(lsTreeCmd).PositionalCompletion(
git.ActionRefs(git.RefOption{}.Default()),
)

carapace.Gen(lsTreeCmd).PositionalAnyCompletion(
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
return git.ActionRefFiles(c.Args[0])
}),
)
}
28 changes: 0 additions & 28 deletions completers/git_completer/cmd/ls_tree_generated.go

This file was deleted.

0 comments on commit e54cbb7

Please sign in to comment.