mirror of
https://github.com/rsteube/carapace-bin.git
synced 2025-05-05 15:32:53 +00:00
Added patool completer (#2751)
* Added patool completer * patool: added recompress --------- Co-authored-by: rsteube <rsteube@users.noreply.github.com>
This commit is contained in:
parent
63483c0976
commit
a283046a3d
23
completers/patool_completer/cmd/create.go
Normal file
23
completers/patool_completer/cmd/create.go
Normal file
@ -0,0 +1,23 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/carapace-sh/carapace"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var createCmd = &cobra.Command{
|
||||
Use: "create",
|
||||
Short: "create an archive",
|
||||
Run: func(cmd *cobra.Command, args []string) {},
|
||||
}
|
||||
|
||||
func init() {
|
||||
carapace.Gen(createCmd).Standalone()
|
||||
|
||||
createCmd.Flags().String("password", "", "password to encrypt files")
|
||||
rootCmd.AddCommand(createCmd)
|
||||
|
||||
carapace.Gen(createCmd).PositionalAnyCompletion(
|
||||
carapace.ActionFiles(),
|
||||
)
|
||||
}
|
23
completers/patool_completer/cmd/diff.go
Normal file
23
completers/patool_completer/cmd/diff.go
Normal file
@ -0,0 +1,23 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/carapace-sh/carapace"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var diffCmd = &cobra.Command{
|
||||
Use: "diff",
|
||||
Short: "show differences between two archives",
|
||||
Run: func(cmd *cobra.Command, args []string) {},
|
||||
}
|
||||
|
||||
func init() {
|
||||
carapace.Gen(diffCmd).Standalone()
|
||||
|
||||
rootCmd.AddCommand(diffCmd)
|
||||
|
||||
carapace.Gen(diffCmd).PositionalCompletion(
|
||||
carapace.ActionFiles(),
|
||||
carapace.ActionFiles(),
|
||||
)
|
||||
}
|
28
completers/patool_completer/cmd/extract.go
Normal file
28
completers/patool_completer/cmd/extract.go
Normal file
@ -0,0 +1,28 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/carapace-sh/carapace"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var extractCmd = &cobra.Command{
|
||||
Use: "extract",
|
||||
Short: "extract one or more archives",
|
||||
Run: func(cmd *cobra.Command, args []string) {},
|
||||
}
|
||||
|
||||
func init() {
|
||||
carapace.Gen(extractCmd).Standalone()
|
||||
|
||||
extractCmd.Flags().String("outdir", "", "output directory to extract to")
|
||||
extractCmd.Flags().String("password", "", "password for encrypted files")
|
||||
rootCmd.AddCommand(extractCmd)
|
||||
|
||||
carapace.Gen(extractCmd).FlagCompletion(carapace.ActionMap{
|
||||
"outdir": carapace.ActionDirectories(),
|
||||
})
|
||||
|
||||
carapace.Gen(extractCmd).PositionalAnyCompletion(
|
||||
carapace.ActionFiles(),
|
||||
)
|
||||
}
|
18
completers/patool_completer/cmd/formats.go
Normal file
18
completers/patool_completer/cmd/formats.go
Normal file
@ -0,0 +1,18 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/carapace-sh/carapace"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var formatsCmd = &cobra.Command{
|
||||
Use: "formats",
|
||||
Short: "show supported archive formats",
|
||||
Run: func(cmd *cobra.Command, args []string) {},
|
||||
}
|
||||
|
||||
func init() {
|
||||
carapace.Gen(formatsCmd).Standalone()
|
||||
|
||||
rootCmd.AddCommand(formatsCmd)
|
||||
}
|
23
completers/patool_completer/cmd/list.go
Normal file
23
completers/patool_completer/cmd/list.go
Normal file
@ -0,0 +1,23 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/carapace-sh/carapace"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var listCmd = &cobra.Command{
|
||||
Use: "list",
|
||||
Short: "list members or one or more archives",
|
||||
Run: func(cmd *cobra.Command, args []string) {},
|
||||
}
|
||||
|
||||
func init() {
|
||||
carapace.Gen(listCmd).Standalone()
|
||||
|
||||
listCmd.Flags().String("password", "", "password for encrypted files")
|
||||
rootCmd.AddCommand(listCmd)
|
||||
|
||||
carapace.Gen(listCmd).PositionalAnyCompletion(
|
||||
carapace.ActionFiles(),
|
||||
)
|
||||
}
|
22
completers/patool_completer/cmd/recompress.go
Normal file
22
completers/patool_completer/cmd/recompress.go
Normal file
@ -0,0 +1,22 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/carapace-sh/carapace"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var recompressCmd = &cobra.Command{
|
||||
Use: "recompress",
|
||||
Short: "recompress an archive",
|
||||
Run: func(cmd *cobra.Command, args []string) {},
|
||||
}
|
||||
|
||||
func init() {
|
||||
carapace.Gen(recompressCmd).Standalone()
|
||||
|
||||
rootCmd.AddCommand(recompressCmd)
|
||||
|
||||
carapace.Gen(recompressCmd).PositionalCompletion(
|
||||
carapace.ActionFiles(),
|
||||
)
|
||||
}
|
23
completers/patool_completer/cmd/repack.go
Normal file
23
completers/patool_completer/cmd/repack.go
Normal file
@ -0,0 +1,23 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/carapace-sh/carapace"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var repackCmd = &cobra.Command{
|
||||
Use: "repack",
|
||||
Short: "repack an archive to a different format",
|
||||
Run: func(cmd *cobra.Command, args []string) {},
|
||||
}
|
||||
|
||||
func init() {
|
||||
carapace.Gen(repackCmd).Standalone()
|
||||
|
||||
rootCmd.AddCommand(repackCmd)
|
||||
|
||||
carapace.Gen(repackCmd).PositionalCompletion(
|
||||
carapace.ActionFiles(),
|
||||
carapace.ActionFiles(),
|
||||
)
|
||||
}
|
27
completers/patool_completer/cmd/root.go
Normal file
27
completers/patool_completer/cmd/root.go
Normal file
@ -0,0 +1,27 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/carapace-sh/carapace"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "patool",
|
||||
Short: "An archive file manager",
|
||||
Long: "http://wummel.github.io/patool/",
|
||||
Run: func(cmd *cobra.Command, args []string) {},
|
||||
}
|
||||
|
||||
func Execute() error {
|
||||
return rootCmd.Execute()
|
||||
}
|
||||
|
||||
func init() {
|
||||
carapace.Gen(rootCmd).Standalone()
|
||||
|
||||
rootCmd.Flags().Bool("non-interactive", false, "don't query for user input")
|
||||
rootCmd.Flags().CountP("quiet", "q", "quiet operation")
|
||||
rootCmd.Flags().CountP("verbose", "v", "verbose operation")
|
||||
|
||||
rootCmd.PersistentFlags().BoolP("help", "h", false, "show this help message and exit")
|
||||
}
|
24
completers/patool_completer/cmd/search.go
Normal file
24
completers/patool_completer/cmd/search.go
Normal file
@ -0,0 +1,24 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/carapace-sh/carapace"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var searchCmd = &cobra.Command{
|
||||
Use: "search",
|
||||
Short: "search contents of archive members",
|
||||
Run: func(cmd *cobra.Command, args []string) {},
|
||||
}
|
||||
|
||||
func init() {
|
||||
carapace.Gen(searchCmd).Standalone()
|
||||
|
||||
searchCmd.Flags().String("password", "", "password for encrypted files")
|
||||
rootCmd.AddCommand(searchCmd)
|
||||
|
||||
carapace.Gen(searchCmd).PositionalCompletion(
|
||||
carapace.ActionValues(),
|
||||
carapace.ActionFiles(),
|
||||
)
|
||||
}
|
23
completers/patool_completer/cmd/test.go
Normal file
23
completers/patool_completer/cmd/test.go
Normal file
@ -0,0 +1,23 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/carapace-sh/carapace"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var testCmd = &cobra.Command{
|
||||
Use: "test",
|
||||
Short: "test an archive",
|
||||
Run: func(cmd *cobra.Command, args []string) {},
|
||||
}
|
||||
|
||||
func init() {
|
||||
carapace.Gen(testCmd).Standalone()
|
||||
|
||||
testCmd.Flags().String("password", "", "password for encrypted files")
|
||||
rootCmd.AddCommand(testCmd)
|
||||
|
||||
carapace.Gen(testCmd).PositionalAnyCompletion(
|
||||
carapace.ActionFiles(),
|
||||
)
|
||||
}
|
18
completers/patool_completer/cmd/version.go
Normal file
18
completers/patool_completer/cmd/version.go
Normal file
@ -0,0 +1,18 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/carapace-sh/carapace"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "print version information",
|
||||
Run: func(cmd *cobra.Command, args []string) {},
|
||||
}
|
||||
|
||||
func init() {
|
||||
carapace.Gen(versionCmd).Standalone()
|
||||
|
||||
rootCmd.AddCommand(versionCmd)
|
||||
}
|
7
completers/patool_completer/main.go
Normal file
7
completers/patool_completer/main.go
Normal file
@ -0,0 +1,7 @@
|
||||
package main
|
||||
|
||||
import "github.com/carapace-sh/carapace-bin/completers/patool_completer/cmd"
|
||||
|
||||
func main() {
|
||||
cmd.Execute()
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user