-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #191 from rsteube/add-git-init-and-rm
added git init and rm
- Loading branch information
Showing
3 changed files
with
57 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var initCmd = &cobra.Command{ | ||
Use: "init", | ||
Short: "Create an empty Git repository or reinitialize an existing one", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(initCmd).Standalone() | ||
|
||
initCmd.Flags().Bool("bare", false, "create a bare repository") | ||
initCmd.Flags().StringP("initial-branch", "b", "", "override the name of the initial branch") | ||
initCmd.Flags().String("object-format", "", "specify the hash algorithm to use") | ||
initCmd.Flags().BoolP("quiet", "q", false, "be quiet") | ||
initCmd.Flags().String("separate-git-dir", "", "separate git dir from working tree") | ||
initCmd.Flags().String("shared", "", "specify that the git repository is to be shared amongst several users") | ||
initCmd.Flags().String("template", "", "directory from which templates will be used") | ||
rootCmd.AddCommand(initCmd) | ||
|
||
initCmd.Flag("shared").NoOptDefVal = "umask" | ||
|
||
carapace.Gen(initCmd).FlagCompletion(carapace.ActionMap{ | ||
"object-format": carapace.ActionValues("sha1", "sha256"), | ||
"separate-git-dir": carapace.ActionFiles(""), | ||
"shared": carapace.ActionValuesDescribed( | ||
"false", "use permissions reported by umask", | ||
"true", "make the repository group-writable", | ||
"umask", "use permissions reported by umask", | ||
"group", "make the repository group-writable", | ||
"all", "make repository readable by all users", | ||
"world", "make repository readable by all users", | ||
"everybody", "make repository readable by all users", | ||
), | ||
"template": carapace.ActionDirectories(), | ||
}) | ||
|
||
carapace.Gen(initCmd).PositionalCompletion(carapace.ActionFiles("")) | ||
} |
This file was deleted.
Oops, something went wrong.
18 changes: 13 additions & 5 deletions
18
completers/git_completer/cmd/rm_generated.go → completers/git_completer/cmd/rm.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,32 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var rmCmd = &cobra.Command{ | ||
Use: "rm", | ||
Short: "Remove files from the working tree and from the index", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
}, | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func init() { | ||
carapace.Gen(rmCmd).Standalone() | ||
|
||
rmCmd.Flags().BoolS("r", "r", false, "allow recursive removal") | ||
rmCmd.Flags().Bool("cached", false, "only remove from the index") | ||
rmCmd.Flags().BoolP("dry-run", "n", false, "dry run") | ||
rmCmd.Flags().BoolP("force", "f", false, "override the up-to-date check") | ||
rmCmd.Flags().Bool("ignore-unmatch", false, "exit with a zero status even if nothing matched") | ||
rmCmd.Flags().BoolP("dry-run", "n", false, "dry run") | ||
rmCmd.Flags().Bool("pathspec-file-nul", false, "with --pathspec-from-file, pathspec elements are separated with NUL character") | ||
rmCmd.Flags().Bool("pathspec-file-nul", false, "pathspec elements are separated with NUL character") | ||
rmCmd.Flags().String("pathspec-from-file", "", "read pathspec from file") | ||
rmCmd.Flags().BoolP("quiet", "q", false, "do not list removed files") | ||
rmCmd.Flags().BoolS("r", "r", false, "allow recursive removal") | ||
rootCmd.AddCommand(rmCmd) | ||
|
||
carapace.Gen(rmCmd).FlagCompletion(carapace.ActionMap{ | ||
"pathspec-from-file": carapace.ActionFiles(""), | ||
}) | ||
|
||
carapace.Gen(rmCmd).PositionalAnyCompletion(carapace.ActionFiles("")) | ||
} |