mirror of
https://github.com/onyx-and-iris/exclude.git
synced 2026-03-30 23:19:09 +00:00
skip pre/post hooks for completion command
This commit is contained in:
parent
9173cbe01b
commit
92e84ca582
@ -28,6 +28,10 @@ It allows you to add, list, and delete patterns from the exclude file easily.
|
|||||||
This tool is particularly useful for developers who want to keep their repository clean
|
This tool is particularly useful for developers who want to keep their repository clean
|
||||||
by excluding certain files or directories from version control.`,
|
by excluding certain files or directories from version control.`,
|
||||||
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
if cmd.Name() == "completion" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
if _, err := os.Stat(".git"); os.IsNotExist(err) {
|
if _, err := os.Stat(".git"); os.IsNotExist(err) {
|
||||||
return fmt.Errorf("this command must be run in a Git repository")
|
return fmt.Errorf("this command must be run in a Git repository")
|
||||||
}
|
}
|
||||||
@ -42,6 +46,10 @@ by excluding certain files or directories from version control.`,
|
|||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
PersistentPostRunE: func(cmd *cobra.Command, args []string) error {
|
PersistentPostRunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
if cmd.Name() == "completion" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
if ctx, ok := ContextObjectFromContext(cmd.Context()); ok {
|
if ctx, ok := ContextObjectFromContext(cmd.Context()); ok {
|
||||||
defer ctx.File.Close()
|
defer ctx.File.Close()
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user