diff --git a/completers/flatpak_completer/cmd/build.go b/completers/flatpak_completer/cmd/build.go new file mode 100644 index 0000000000..c88acb951c --- /dev/null +++ b/completers/flatpak_completer/cmd/build.go @@ -0,0 +1,92 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var buildCmd = &cobra.Command{ + Use: "build [OPTION…] DIRECTORY [COMMAND [ARGUMENT…]]", + Short: "Build in directory", + GroupID: "build", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(buildCmd).Standalone() + + buildCmd.Flags().String("add-policy", "", "Add generic policy option") + buildCmd.Flags().String("allow", "", "Allow feature") + buildCmd.Flags().String("bind-mount", "", "Add bind mount") + buildCmd.Flags().String("build-dir", "", "Start build in this directory") + buildCmd.Flags().String("device", "", "Expose device to app") + buildCmd.Flags().BoolP("die-with-parent", "p", false, "Kill processes when the parent process dies") + buildCmd.Flags().String("disallow", "", "Don't allow feature") + buildCmd.Flags().String("env", "", "Set environment variable") + buildCmd.Flags().String("env-fd", "", "Read environment variables in env -0 format from FD") + buildCmd.Flags().String("filesystem", "", "Expose filesystem to app (:ro for read-only)") + buildCmd.Flags().BoolP("help", "h", false, "Show help options") + buildCmd.Flags().Bool("help-all", false, "Show all help options") + buildCmd.Flags().Bool("log-session-bus", false, "Log session bus calls") + buildCmd.Flags().Bool("log-system-bus", false, "Log system bus calls") + buildCmd.Flags().String("metadata", "", "Use alternative file for the metadata") + buildCmd.Flags().String("no-talk-name", "", "Don't allow app to talk to name on the session bus") + buildCmd.Flags().String("nodevice", "", "Don't expose device to app") + buildCmd.Flags().String("nofilesystem", "", "Don't expose filesystem to app") + buildCmd.Flags().String("nosocket", "", "Don't expose socket to app") + buildCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + buildCmd.Flags().String("own-name", "", "Allow app to own name on the session bus") + buildCmd.Flags().String("persist", "", "Persist home directory subpath") + buildCmd.Flags().Bool("readonly", false, "Make destination readonly") + buildCmd.Flags().String("remove-policy", "", "Remove generic policy option") + buildCmd.Flags().BoolP("runtime", "r", false, "Use Platform runtime rather than Sdk") + buildCmd.Flags().String("sdk-dir", "", "Where to look for custom sdk dir (defaults to 'usr')") + buildCmd.Flags().String("share", "", "Share with host") + buildCmd.Flags().String("socket", "", "Expose socket to app") + buildCmd.Flags().String("system-no-talk-name", "", "Don't allow app to talk to name on the system bus") + buildCmd.Flags().String("system-own-name", "", "Allow app to own name on the system bus") + buildCmd.Flags().String("system-talk-name", "", "Allow app to talk to name on the system bus") + buildCmd.Flags().String("talk-name", "", "Allow app to talk to name on the session bus") + buildCmd.Flags().String("unset-env", "", "Remove variable from environment") + buildCmd.Flags().String("unshare", "", "Unshare with host") + buildCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + buildCmd.Flags().Bool("with-appdir", false, "Export application homedir directory to build") + rootCmd.AddCommand(buildCmd) + + // TODO flag + carapace.Gen(buildCmd).FlagCompletion(carapace.ActionMap{ + // "add-policy": carapace.ActionValues(), + // "allow": carapace.ActionValues(), + // "bind-mount": carapace.ActionValues(), + "build-dir": carapace.ActionDirectories(), + // "device": carapace.ActionValues(), + // "disallow": carapace.ActionValues(), + // "env": carapace.ActionValues(), + // "env-fd": carapace.ActionValues(), + // "filesystem": carapace.ActionValues(), + // "metadata": carapace.ActionValues(), + // "no-talk-name": carapace.ActionValues(), + // "nodevice": carapace.ActionValues(), + // "nofilesystem": carapace.ActionValues(), + // "nosocket": carapace.ActionValues(), + // "own-name": carapace.ActionValues(), + // "persist": carapace.ActionValues(), + // "remove-policy": carapace.ActionValues(), + "sdk-dir": carapace.ActionDirectories(), + // "share": carapace.ActionValues(), + // "socket": carapace.ActionValues(), + // "system-no-talk-name": carapace.ActionValues(), + // "system-own-name": carapace.ActionValues(), + // "system-talk-name": carapace.ActionValues(), + // "talk-name": carapace.ActionValues(), + // "unset-env": carapace.ActionValues(), + // "unshare": carapace.ActionValues(), + }) + + carapace.Gen(buildCmd).PositionalCompletion( + carapace.ActionDirectories(), + // TODO command + ) + + // TODO command arguments +} diff --git a/completers/flatpak_completer/cmd/buildCommitFrom.go b/completers/flatpak_completer/cmd/buildCommitFrom.go new file mode 100644 index 0000000000..7b42f8bcc5 --- /dev/null +++ b/completers/flatpak_completer/cmd/buildCommitFrom.go @@ -0,0 +1,59 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/os" + "github.com/spf13/cobra" +) + +var buildCommitFromCmd = &cobra.Command{ + Use: "build-commit-from [OPTION…] DST-REPO [DST-REF…]", + Short: "Make a new commit from existing commits", + GroupID: "build", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(buildCommitFromCmd).Standalone() + + buildCommitFromCmd.Flags().StringP("body", "b", "", "Full description") + buildCommitFromCmd.Flags().Bool("disable-fsync", false, "Do not invoke fsync()") + buildCommitFromCmd.Flags().String("end-of-life", "", "Mark build as end-of-life") + buildCommitFromCmd.Flags().String("end-of-life-rebase", "", "Mark refs matching the OLDID prefix as end-of-life, to be replaced with the given NEWID") + buildCommitFromCmd.Flags().String("extra-collection-id", "", "Add an extra collection id ref and binding") + buildCommitFromCmd.Flags().Bool("force", false, "Always commit, even if same content") + buildCommitFromCmd.Flags().String("gpg-homedir", "", "GPG Homedir to use when looking for keyrings") + buildCommitFromCmd.Flags().String("gpg-sign", "", "GPG Key ID to sign the commit with") + buildCommitFromCmd.Flags().BoolP("help", "h", false, "Show help options") + buildCommitFromCmd.Flags().Bool("no-summary-index", false, "Don't generate a summary index") + buildCommitFromCmd.Flags().Bool("no-update-summary", false, "Don't update the summary") + buildCommitFromCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + buildCommitFromCmd.Flags().String("src-ref", "", "Source repo ref") + buildCommitFromCmd.Flags().String("src-repo", "", "Source repo dir") + buildCommitFromCmd.Flags().StringP("subject", "s", "", "One line subject") + buildCommitFromCmd.Flags().String("subset", "", "Add to a named subset") + buildCommitFromCmd.Flags().String("timestamp", "", "Override the timestamp of the commit (NOW for current time)") + buildCommitFromCmd.Flags().String("token-type", "", "Set type of token needed to install this commit") + buildCommitFromCmd.Flags().Bool("untrusted", false, "Do not trust SRC-REPO") + buildCommitFromCmd.Flags().Bool("update-appstream", false, "Update the appstream branch") + buildCommitFromCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(buildCommitFromCmd) + + // TODO flag + carapace.Gen(buildCommitFromCmd).FlagCompletion(carapace.ActionMap{ + // "body": carapace.ActionValues(), + // "end-of-life": carapace.ActionValues(), + // "end-of-life-rebase": carapace.ActionValues(), + // "extra-collection-id": carapace.ActionValues(), + "gpg-homedir": carapace.ActionDirectories(), + "gpg-sign": os.ActionGpgKeyIds(), // TODO handle gpg-homedir + // "src-ref": carapace.ActionValues(), + // "src-repo": carapace.ActionValues(), + // "subject": carapace.ActionValues(), + // "subset": carapace.ActionValues(), + // "timestamp": carapace.ActionValues(), + // "token-type" : carapace.ActionValues(), + }) + + // TODO positional +} diff --git a/completers/flatpak_completer/cmd/buildExport.go b/completers/flatpak_completer/cmd/buildExport.go new file mode 100644 index 0000000000..4a91955d15 --- /dev/null +++ b/completers/flatpak_completer/cmd/buildExport.go @@ -0,0 +1,68 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var buildExportCmd = &cobra.Command{ + Use: "build-export [OPTION…] LOCATION DIRECTORY [BRANCH]", + Short: "Create a repository from a build directory", + GroupID: "build", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(buildExportCmd).Standalone() + + buildExportCmd.Flags().String("arch", "", "Architecture to export for (must be host compatible)") + buildExportCmd.Flags().StringP("body", "b", "", "Full description") + buildExportCmd.Flags().String("collection-id", "", "Collection ID") + buildExportCmd.Flags().Bool("disable-fsync", false, "Do not invoke fsync()") + buildExportCmd.Flags().Bool("disable-sandbox", false, "Do not sandbox icon validator") + buildExportCmd.Flags().String("end-of-life", "", "Mark build as end-of-life") + buildExportCmd.Flags().String("end-of-life-rebase", "", "Mark build as end-of-life, to be replaced with the given ID") + buildExportCmd.Flags().String("exclude", "", "Files to exclude") + buildExportCmd.Flags().String("files", "", "Use alternative directory for the files") + buildExportCmd.Flags().String("gpg-homedir", "", "GPG Homedir to use when looking for keyrings") + buildExportCmd.Flags().String("gpg-sign", "", "GPG Key ID to sign the commit with") + buildExportCmd.Flags().BoolP("help", "h", false, "Show help options") + buildExportCmd.Flags().String("include", "", "Excluded files to include") + buildExportCmd.Flags().String("metadata", "", "Use alternative file for the metadata") + buildExportCmd.Flags().Bool("no-summary-index", false, "Don't generate a summary index") + buildExportCmd.Flags().Bool("no-update-summary", false, "Don't update the summary") + buildExportCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + buildExportCmd.Flags().BoolP("runtime", "r", false, "Commit runtime (/usr), not /app") + buildExportCmd.Flags().StringP("subject", "s", "", "One line subject") + buildExportCmd.Flags().String("subset", "", "Add to a named subset") + buildExportCmd.Flags().String("timestamp", "", "Override the timestamp of the commit") + buildExportCmd.Flags().String("token-type", "", "Set type of token needed to install this commit") + buildExportCmd.Flags().Bool("update-appstream", false, "Update the appstream branch") + buildExportCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(buildExportCmd) + + // TODO flag + carapace.Gen(buildExportCmd).FlagCompletion(carapace.ActionMap{ + // "arch": carapace.ActionValues(), + // "body": carapace.ActionValues(), + // "collection-id": carapace.ActionValues(), + // "end-of-life": carapace.ActionValues(), + // "end-of-life-rebase": carapace.ActionValues(), + // "exclude": carapace.ActionValues(), + // "files": carapace.ActionValues(), + // "gpg-homedir": carapace.ActionValues(), + // "gpg-sign": carapace.ActionValues(), + // "include": carapace.ActionValues(), + // "metadata": carapace.ActionValues(), + // "subject": carapace.ActionValues(), + // "subset": carapace.ActionValues(), + // "timestamp": carapace.ActionValues(), + // "token-type": carapace.ActionValues(), + }) + + carapace.Gen(buildExportCmd).PositionalCompletion( + carapace.ActionValues(), // TODO location + carapace.ActionDirectories(), + carapace.ActionValues(), // TODO branch + ) +} diff --git a/completers/flatpak_completer/cmd/buildFinish.go b/completers/flatpak_completer/cmd/buildFinish.go new file mode 100644 index 0000000000..720cb1fee1 --- /dev/null +++ b/completers/flatpak_completer/cmd/buildFinish.go @@ -0,0 +1,94 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var buildFinishCmd = &cobra.Command{ + Use: "build-finish [OPTION…] DIRECTORY", + Short: "Finalize a build directory", + GroupID: "build", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(buildFinishCmd).Standalone() + + buildFinishCmd.Flags().String("add-policy", "", "Add generic policy option") + buildFinishCmd.Flags().String("allow", "", "Allow feature") + buildFinishCmd.Flags().String("command", "", "Command to set") + buildFinishCmd.Flags().String("device", "", "Expose device to app") + buildFinishCmd.Flags().String("disallow", "", "Don't allow feature") + buildFinishCmd.Flags().String("env", "", "Set environment variable") + buildFinishCmd.Flags().String("env-fd", "", "Read environment variables in env -0 format from FD") + buildFinishCmd.Flags().String("extension", "", "Add extension point info") + buildFinishCmd.Flags().String("extension-priority", "", "Set extension priority (only for extensions)") + buildFinishCmd.Flags().Bool("extra-data", false, "Extra data info") + buildFinishCmd.Flags().String("filesystem", "", "Expose filesystem to app (:ro for read-only)") + buildFinishCmd.Flags().BoolP("help", "h", false, "Show help options") + buildFinishCmd.Flags().Bool("help-all", false, "Show all help options") + buildFinishCmd.Flags().String("metadata", "", "Set generic metadata option") + buildFinishCmd.Flags().Bool("no-exports", false, "Don't process exports") + buildFinishCmd.Flags().Bool("no-inherit-permissions", false, "Don't inherit permissions from runtime") + buildFinishCmd.Flags().String("no-talk-name", "", "Don't allow app to talk to name on the session bus") + buildFinishCmd.Flags().String("nodevice", "", "Don't expose device to app") + buildFinishCmd.Flags().String("nofilesystem", "", "Don't expose filesystem to app") + buildFinishCmd.Flags().String("nosocket", "", "Don't expose socket to app") + buildFinishCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + buildFinishCmd.Flags().String("own-name", "", "Allow app to own name on the session bus") + buildFinishCmd.Flags().String("persist", "", "Persist home directory subpath") + buildFinishCmd.Flags().String("remove-extension", "", "Remove extension point info") + buildFinishCmd.Flags().String("remove-policy", "", "Remove generic policy option") + buildFinishCmd.Flags().String("require-version", "", "Flatpak version to require") + buildFinishCmd.Flags().String("runtime", "", "Change the runtime used for the app") + buildFinishCmd.Flags().String("sdk", "", "Change the sdk used for the app") + buildFinishCmd.Flags().String("share", "", "Share with host") + buildFinishCmd.Flags().String("socket", "", "Expose socket to app") + buildFinishCmd.Flags().String("system-no-talk-name", "", "Don't allow app to talk to name on the system bus") + buildFinishCmd.Flags().String("system-own-name", "", "Allow app to own name on the system bus") + buildFinishCmd.Flags().String("system-talk-name", "", "Allow app to talk to name on the system bus") + buildFinishCmd.Flags().String("talk-name", "", "Allow app to talk to name on the session bus") + buildFinishCmd.Flags().String("unset-env", "", "Remove variable from environment") + buildFinishCmd.Flags().String("unshare", "", "Unshare with host") + buildFinishCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(buildFinishCmd) + + // TODO flags + carapace.Gen(buildFinishCmd).FlagCompletion(carapace.ActionMap{ + // "add-policy": carapace.ActionValues(). + // "allow": carapace.ActionValues(). + // "command": carapace.ActionValues(). + // "device": carapace.ActionValues(). + // "disallow": carapace.ActionValues(). + // "env": carapace.ActionValues(). + // "env-fd": carapace.ActionValues(). + // "extension": carapace.ActionValues(). + // "extension-priority": carapace.ActionValues(). + // "filesystem": carapace.ActionValues(). + // "metadata": carapace.ActionValues(). + // "no-talk-name": carapace.ActionValues(). + // "nodevice": carapace.ActionValues(). + // "nofilesystem": carapace.ActionValues(). + // "nosocket": carapace.ActionValues(). + // "own-name": carapace.ActionValues(). + // "persist": carapace.ActionValues(). + // "remove-extension": carapace.ActionValues(). + // "remove-policy": carapace.ActionValues(). + // "require-version": carapace.ActionValues(). + // "runtime": carapace.ActionValues(). + // "sdk": carapace.ActionValues(). + // "share": carapace.ActionValues(). + // "socket": carapace.ActionValues(). + // "system-no-talk-name": carapace.ActionValues(). + // "system-own-name": carapace.ActionValues(). + // "system-talk-name": carapace.ActionValues(). + // "talk-name": carapace.ActionValues(). + // "unset-env": carapace.ActionValues(). + // "unshare" : carapace.ActionValues(). + }) + + carapace.Gen(buildFinishCmd).PositionalCompletion( + carapace.ActionDirectories(), + ) +} diff --git a/completers/flatpak_completer/cmd/buildImportBundle.go b/completers/flatpak_completer/cmd/buildImportBundle.go new file mode 100644 index 0000000000..8a224e6fba --- /dev/null +++ b/completers/flatpak_completer/cmd/buildImportBundle.go @@ -0,0 +1,41 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/os" + "github.com/spf13/cobra" +) + +var buildImportBundleCmd = &cobra.Command{ + Use: "build-import-bundle [OPTION…] LOCATION FILENAME", + Short: "Import a file bundle into a local repository", + GroupID: "build", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(buildImportBundleCmd).Standalone() + + buildImportBundleCmd.Flags().String("gpg-homedir", "", "GPG Homedir to use when looking for keyrings") + buildImportBundleCmd.Flags().String("gpg-sign", "", "GPG Key ID to sign the commit with") + buildImportBundleCmd.Flags().BoolP("help", "h", false, "Show help options") + buildImportBundleCmd.Flags().Bool("no-summary-index", false, "Don't generate a summary index") + buildImportBundleCmd.Flags().Bool("no-update-summary", false, "Don't update the summary") + buildImportBundleCmd.Flags().Bool("oci", false, "Import oci image instead of flatpak bundle") + buildImportBundleCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + buildImportBundleCmd.Flags().String("ref", "", "Override the ref used for the imported bundle") + buildImportBundleCmd.Flags().Bool("update-appstream", false, "Update the appstream branch") + buildImportBundleCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(buildImportBundleCmd) + + carapace.Gen(buildImportBundleCmd).FlagCompletion(carapace.ActionMap{ + "gpg-homedir": carapace.ActionDirectories(), + "gpg-sign": os.ActionGpgKeyIds(), // TODO handle gpg-homedir flag + // "ref": carapace.ActionValues(), // TODO + }) + + carapace.Gen(buildImportBundleCmd).PositionalCompletion( + carapace.ActionValues(), // TODO location + carapace.ActionFiles(), + ) +} diff --git a/completers/flatpak_completer/cmd/buildInit.go b/completers/flatpak_completer/cmd/buildInit.go new file mode 100644 index 0000000000..5c17b51303 --- /dev/null +++ b/completers/flatpak_completer/cmd/buildInit.go @@ -0,0 +1,61 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var buildInitCmd = &cobra.Command{ + Use: "build-init [OPTION…] DIRECTORY APPNAME SDK RUNTIME [BRANCH]", + Short: "Initialize a directory for building", + GroupID: "build", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(buildInitCmd).Standalone() + + buildInitCmd.Flags().String("arch", "", "Arch to use") + buildInitCmd.Flags().String("base", "", "Initialize apps from named app") + buildInitCmd.Flags().String("base-extension", "", "Include this base extension") + buildInitCmd.Flags().String("base-version", "", "Specify version for --base") + buildInitCmd.Flags().String("extension", "", "Add extension point info") + buildInitCmd.Flags().String("extension-tag", "", "Extension tag to use if building extension") + buildInitCmd.Flags().BoolP("help", "h", false, "Show help options") + buildInitCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + buildInitCmd.Flags().String("sdk-dir", "", "Where to store sdk (defaults to 'usr')") + buildInitCmd.Flags().String("sdk-extension", "", "Include this sdk extension in /usr") + buildInitCmd.Flags().String("tag", "", "Add a tag") + buildInitCmd.Flags().String("type", "", "Specify the build type (app, runtime, extension)") + buildInitCmd.Flags().Bool("update", false, "Re-initialize the sdk/var") + buildInitCmd.Flags().StringP("var", "v", "", "Initialize var from named runtime") + buildInitCmd.Flags().Bool("verbose", false, "Show debug information, -vv for more detail") + buildInitCmd.Flags().BoolP("writable-sdk", "w", false, "Initialize /usr with a writable copy of the sdk") + rootCmd.AddCommand(buildInitCmd) + + // TODO flags + carapace.Gen(buildInitCmd).FlagCompletion(carapace.ActionMap{ + "arch": flatpak.ActionArches(), + // "base": carapace.ActionValues(), + // "base-extension": carapace.ActionValues(), + // "base-version": carapace.ActionValues(), + // "extension": carapace.ActionValues(), + // "extension-tag": carapace.ActionValues(), + // "sdk-dir": carapace.ActionDirectories(), + // "sdk-extension": carapace.ActionValues(), + // "tag": carapace.ActionValues(), + "type": carapace.ActionValues("app", "runtime", "extension"), + // "var": carapace.ActionValues(), + }) + + // build-init [OPTION…] DIRECTORY APPNAME SDK RUNTIME [BRANCH] + carapace.Gen(buildInitCmd).PositionalCompletion( + carapace.ActionDirectories(), + carapace.ActionValues(), // TODO appname + carapace.ActionValues(), // TODO sdk + carapace.ActionValues(), // TODO runtime + carapace.ActionValues(), // TODO branch + + ) +} diff --git a/completers/flatpak_completer/cmd/buildSign.go b/completers/flatpak_completer/cmd/buildSign.go new file mode 100644 index 0000000000..0c97316d93 --- /dev/null +++ b/completers/flatpak_completer/cmd/buildSign.go @@ -0,0 +1,37 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/os" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var buildSignCmd = &cobra.Command{ + Use: "build-sign [OPTION…] LOCATION [ID [BRANCH]]", + Short: "Sign an application or runtime", + GroupID: "build", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(buildSignCmd).Standalone() + + buildSignCmd.Flags().String("arch", "", "Arch to install for") + buildSignCmd.Flags().String("gpg-homedir", "", "GPG Homedir to use when looking for keyrings") + buildSignCmd.Flags().String("gpg-sign", "", "GPG Key ID to sign the commit with") + buildSignCmd.Flags().BoolP("help", "h", false, "Show help options") + buildSignCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + buildSignCmd.Flags().Bool("runtime", false, "Look for runtime with the specified name") + buildSignCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(buildSignCmd) + + carapace.Gen(buildSignCmd).FlagCompletion(carapace.ActionMap{ + "arch": flatpak.ActionArches(), + "gpg-homedir": carapace.ActionDirectories(), // TODO handle gpg-sign + "gpg-sign": os.ActionGpgKeyIds(), + }) + + // TODO positional + +} diff --git a/completers/flatpak_completer/cmd/buildUpdateRepo.go b/completers/flatpak_completer/cmd/buildUpdateRepo.go new file mode 100644 index 0000000000..9b4fe0a349 --- /dev/null +++ b/completers/flatpak_completer/cmd/buildUpdateRepo.go @@ -0,0 +1,71 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/os" + "github.com/spf13/cobra" +) + +var buildUpdateRepoCmd = &cobra.Command{ + Use: "build-update-repo [OPTION…] LOCATION", + Short: "Update repository metadata", + GroupID: "build", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(buildUpdateRepoCmd).Standalone() + + buildUpdateRepoCmd.Flags().Bool("authenticator-install", false, "Autoinstall authenticator for this repository") + buildUpdateRepoCmd.Flags().String("authenticator-name", "", "Name of authenticator for this repository") + buildUpdateRepoCmd.Flags().String("authenticator-option", "", "Authenticator option") + buildUpdateRepoCmd.Flags().String("collection-id", "", "Collection ID") + buildUpdateRepoCmd.Flags().String("comment", "", "A one-line comment for this repository") + buildUpdateRepoCmd.Flags().String("default-branch", "", "Default branch to use for this repository") + buildUpdateRepoCmd.Flags().Bool("deploy-collection-id", false, "Permanently deploy collection ID to client remote configurations") + buildUpdateRepoCmd.Flags().Bool("deploy-sideload-collection-id", false, "Permanently deploy collection ID to client remote configurations, only for sideload support") + buildUpdateRepoCmd.Flags().String("description", "", "A full-paragraph description for this repository") + buildUpdateRepoCmd.Flags().Bool("generate-static-deltas", false, "Generate delta files") + buildUpdateRepoCmd.Flags().String("gpg-homedir", "", "GPG Homedir to use when looking for keyrings") + buildUpdateRepoCmd.Flags().String("gpg-import", "", "Import new default GPG public key from FILE") + buildUpdateRepoCmd.Flags().String("gpg-sign", "", "GPG Key ID to sign the summary with") + buildUpdateRepoCmd.Flags().BoolP("help", "h", false, "Show help options") + buildUpdateRepoCmd.Flags().String("homepage", "", "URL for a website for this repository") + buildUpdateRepoCmd.Flags().String("icon", "", "URL for an icon for this repository") + buildUpdateRepoCmd.Flags().Bool("no-authenticator-install", false, "Don't autoinstall authenticator for this repository") + buildUpdateRepoCmd.Flags().Bool("no-summary-index", false, "Don't generate a summary index") + buildUpdateRepoCmd.Flags().Bool("no-update-appstream", false, "Don't update the appstream branch") + buildUpdateRepoCmd.Flags().Bool("no-update-summary", false, "Don't update the summary") + buildUpdateRepoCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + buildUpdateRepoCmd.Flags().Bool("prune", false, "Prune unused objects") + buildUpdateRepoCmd.Flags().String("prune-depth", "", "Only traverse DEPTH parents for each commit (default: -1=infinite)") + buildUpdateRepoCmd.Flags().Bool("prune-dry-run", false, "Prune but don't actually remove anything") + buildUpdateRepoCmd.Flags().String("redirect-url", "", "Redirect this repo to a new URL") + buildUpdateRepoCmd.Flags().String("static-delta-ignore-ref", "", "Don't create deltas matching refs") + buildUpdateRepoCmd.Flags().String("static-delta-jobs", "", "Max parallel jobs when creating deltas (default: NUMCPUs)") + buildUpdateRepoCmd.Flags().String("title", "", "A nice name to use for this repository") + buildUpdateRepoCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(buildUpdateRepoCmd) + + // flag + carapace.Gen(buildUpdateRepoCmd).FlagCompletion(carapace.ActionMap{ + // "authenticator-name": carapace.ActionValues(), + // "authenticator-option": carapace.ActionValues(), + // "collection-id": carapace.ActionValues(), + // "comment": carapace.ActionValues(), + // "default-branch": carapace.ActionValues(), + // "description": carapace.ActionValues(), + "gpg-homedir": carapace.ActionDirectories(), + "gpg-import": carapace.ActionFiles(), + "gpg-sign": os.ActionGpgKeyIds(), // TODO handle gpg-homedir + // "homepage": carapace.ActionValues(), + // "icon": carapace.ActionValues(), + // "prune-depth": carapace.ActionValues(), + // "redirect-url": carapace.ActionValues(), + // "static-delta-ignore-ref": carapace.ActionValues(), + // "static-delta-jobs": carapace.ActionValues(), + // "title": carapace.ActionValues(), + }) + + // TODO positional +} diff --git a/completers/flatpak_completer/cmd/config.go b/completers/flatpak_completer/cmd/config.go new file mode 100644 index 0000000000..03d8be94c3 --- /dev/null +++ b/completers/flatpak_completer/cmd/config.go @@ -0,0 +1,36 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var configCmd = &cobra.Command{ + Use: "config [OPTION…] [KEY [VALUE]]", + Short: "Manage configuration", + GroupID: "install", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(configCmd).Standalone() + + configCmd.Flags().Bool("get", false, "Get configuration for KEY") + configCmd.Flags().BoolP("help", "h", false, "Show help options") + configCmd.Flags().String("installation", "", "Work on a non-default system-wide installation") + configCmd.Flags().Bool("list", false, "List configuration keys and values") + configCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + configCmd.Flags().Bool("set", false, "Set configuration for KEY to VALUE") + configCmd.Flags().Bool("system", false, "Work on the system-wide installation (default)") + configCmd.Flags().Bool("unset", false, "Unset configuration for KEY") + configCmd.Flags().BoolP("user", "u", false, "Work on the user installation") + configCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(configCmd) + + // TODO flag + + carapace.Gen(configCmd).PositionalCompletion( + // TODO keys + // TODO value when set + ) +} diff --git a/completers/flatpak_completer/cmd/createUsb.go b/completers/flatpak_completer/cmd/createUsb.go new file mode 100644 index 0000000000..2340816822 --- /dev/null +++ b/completers/flatpak_completer/cmd/createUsb.go @@ -0,0 +1,47 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/fs" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var createUsbCmd = &cobra.Command{ + Use: "create-usb [OPTION…] MOUNT-PATH [REF…]", + Short: "Copy apps or runtimes onto removable media", + GroupID: "install", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(createUsbCmd).Standalone() + + createUsbCmd.Flags().Bool("allow-partial", false, "Allow partial commits in the created repo") + createUsbCmd.Flags().Bool("app", false, "Look for app with the specified name") + createUsbCmd.Flags().String("arch", "", "Arch to copy") + createUsbCmd.Flags().String("destination-repo", "", "Use custom repository directory within the mount") + createUsbCmd.Flags().BoolP("help", "h", false, "Show help options") + createUsbCmd.Flags().String("installation", "", "Work on a non-default system-wide installation") + createUsbCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + createUsbCmd.Flags().Bool("runtime", false, "Look for runtime with the specified name") + createUsbCmd.Flags().Bool("system", false, "Work on the system-wide installation (default)") + createUsbCmd.Flags().BoolP("user", "u", false, "Work on the user installation") + createUsbCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(createUsbCmd) + + // TODO flags + carapace.Gen(createUsbCmd).FlagCompletion(carapace.ActionMap{ + "arch": flatpak.ActionArches(), + // "destination-repo": carapace.ActionValues(), + // "installation": carapace.ActionValues(), + }) + + carapace.Gen(createUsbCmd).PositionalCompletion( + carapace.Batch( + fs.ActionMounts(), + carapace.ActionFiles(), + ).ToA(), + // TODO ref + ) +} diff --git a/completers/flatpak_completer/cmd/documentExport.go b/completers/flatpak_completer/cmd/documentExport.go new file mode 100644 index 0000000000..819fb34c98 --- /dev/null +++ b/completers/flatpak_completer/cmd/documentExport.go @@ -0,0 +1,43 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var documentExportCmd = &cobra.Command{ + Use: "document-export [OPTION…] FILE ", + Short: "Export a file to apps", + GroupID: "access", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(documentExportCmd).Standalone() + + documentExportCmd.Flags().BoolP("allow-delete", "d", false, "Give the app delete permissions") + documentExportCmd.Flags().BoolP("allow-grant-permission", "g", false, "Give the app permissions to grant further permissions") + documentExportCmd.Flags().BoolP("allow-read", "r", false, "Give the app read permissions") + documentExportCmd.Flags().BoolP("allow-write", "w", false, "Give the app write permissions") + documentExportCmd.Flags().StringP("app", "a", "", "Add permissions for this app") + documentExportCmd.Flags().Bool("forbid-delete", false, "Revoke delete permissions of the app") + documentExportCmd.Flags().Bool("forbid-grant-permission", false, "Revoke the permission to grant further permissions") + documentExportCmd.Flags().Bool("forbid-read", false, "Revoke read permissions of the app") + documentExportCmd.Flags().Bool("forbid-write", false, "Revoke write permissions of the app") + documentExportCmd.Flags().BoolP("help", "h", false, "Show help options") + documentExportCmd.Flags().BoolP("noexist", "n", false, "Don't require the file to exist already") + documentExportCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + documentExportCmd.Flags().BoolP("transient", "t", false, "Make the document transient for the current session") + documentExportCmd.Flags().BoolP("unique", "u", false, "Create a unique document reference") + documentExportCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(documentExportCmd) + + carapace.Gen(documentExportCmd).FlagCompletion(carapace.ActionMap{ + "app": flatpak.ActionApplications(), + }) + + carapace.Gen(documentExportCmd).PositionalCompletion( + carapace.ActionFiles(), + ) +} diff --git a/completers/flatpak_completer/cmd/documentInfo.go b/completers/flatpak_completer/cmd/documentInfo.go new file mode 100644 index 0000000000..2dc8d75c1e --- /dev/null +++ b/completers/flatpak_completer/cmd/documentInfo.go @@ -0,0 +1,24 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var documentInfoCmd = &cobra.Command{ + Use: "document-info [OPTION…] FILE", + Short: "Get information about an exported file", + GroupID: "access", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(documentInfoCmd).Standalone() + + documentInfoCmd.Flags().BoolP("help", "h", false, "Show help options") + documentInfoCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + documentInfoCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(documentInfoCmd) + + // TODO files from documents command +} diff --git a/completers/flatpak_completer/cmd/documentUnexport.go b/completers/flatpak_completer/cmd/documentUnexport.go new file mode 100644 index 0000000000..45bd2100ee --- /dev/null +++ b/completers/flatpak_completer/cmd/documentUnexport.go @@ -0,0 +1,25 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var documentUnexportCmd = &cobra.Command{ + Use: "document-unexport [OPTION…] FILE", + Short: "Unexport a file to apps", + GroupID: "access", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(documentUnexportCmd).Standalone() + + documentUnexportCmd.Flags().Bool("doc-id", false, "Specify the document ID") + documentUnexportCmd.Flags().BoolP("help", "h", false, "Show help options") + documentUnexportCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + documentUnexportCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(documentUnexportCmd) + + // TODO files from documents command +} diff --git a/completers/flatpak_completer/cmd/documents.go b/completers/flatpak_completer/cmd/documents.go new file mode 100644 index 0000000000..052285c44d --- /dev/null +++ b/completers/flatpak_completer/cmd/documents.go @@ -0,0 +1,32 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var documentsCmd = &cobra.Command{ + Use: "documents [OPTION…] [APPID]", + Short: "List exported files", + GroupID: "access", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(documentsCmd).Standalone() + + documentsCmd.Flags().String("columns", "", "What information to show") + documentsCmd.Flags().BoolP("help", "h", false, "Show help options") + documentsCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + documentsCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(documentsCmd) + + carapace.Gen(documentsCmd).FlagCompletion(carapace.ActionMap{ + "columns": columns(flatpak.ActionDocumentColums()), + }) + + carapace.Gen(documentsCmd).PositionalCompletion( + flatpak.ActionApplications(), + ) +} diff --git a/completers/flatpak_completer/cmd/enter.go b/completers/flatpak_completer/cmd/enter.go new file mode 100644 index 0000000000..c9184a7bbd --- /dev/null +++ b/completers/flatpak_completer/cmd/enter.go @@ -0,0 +1,24 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var enterCmd = &cobra.Command{ + Use: "enter [OPTION…] INSTANCE COMMAND [ARGUMENT…", + Short: "Run a command inside a running sandbox", + GroupID: "run", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(enterCmd).Standalone() + + enterCmd.Flags().BoolP("help", "h", false, "Show help options") + enterCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + enterCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(enterCmd) + + // TODO positional +} diff --git a/completers/flatpak_completer/cmd/history.go b/completers/flatpak_completer/cmd/history.go new file mode 100644 index 0000000000..b665200b37 --- /dev/null +++ b/completers/flatpak_completer/cmd/history.go @@ -0,0 +1,39 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/time" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var historyCmd = &cobra.Command{ + Use: "history [OPTION…]", + Short: "Show history", + GroupID: "install", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(historyCmd).Standalone() + + historyCmd.Flags().String("columns", "", "What information to show") + historyCmd.Flags().BoolP("help", "h", false, "Show help options") + historyCmd.Flags().String("installation", "", "Work on a non-default system-wide installation") + historyCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + historyCmd.Flags().Bool("reverse", false, "Show newest entries first") + historyCmd.Flags().String("since", "", "Only show changes after TIME") + historyCmd.Flags().Bool("system", false, "Work on the system-wide installation (default)") + historyCmd.Flags().String("until", "", "Only show changes before TIME") + historyCmd.Flags().BoolP("user", "u", false, "Work on the user installation") + historyCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(historyCmd) + + // TODO flag + carapace.Gen(historyCmd).FlagCompletion(carapace.ActionMap{ + "columns": columns(flatpak.ActionHistoryColums()), + // "installation": carapace.ActionValues(), + "since": time.ActionDateTime(time.DateTimeOpts{}), + "until": time.ActionDateTime(time.DateTimeOpts{}), + }) +} diff --git a/completers/flatpak_completer/cmd/info.go b/completers/flatpak_completer/cmd/info.go new file mode 100644 index 0000000000..f8e9b1b152 --- /dev/null +++ b/completers/flatpak_completer/cmd/info.go @@ -0,0 +1,50 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var infoCmd = &cobra.Command{ + Use: "info [OPTION…] NAME [BRANCH]", + Short: "Get info about an installed app or runtime", + GroupID: "install", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(infoCmd).Standalone() + + infoCmd.Flags().String("arch", "", "Arch to use") + infoCmd.Flags().String("file-access", "", "Query file access") + infoCmd.Flags().BoolP("help", "h", false, "Show help options") + infoCmd.Flags().String("installation", "", "Show specific system-wide installations") + infoCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + infoCmd.Flags().BoolP("show-commit", "c", false, "Show commit") + infoCmd.Flags().BoolP("show-extensions", "e", false, "Show extensions") + infoCmd.Flags().BoolP("show-location", "l", false, "Show location") + infoCmd.Flags().BoolP("show-metadata", "m", false, "Show metadata") + infoCmd.Flags().BoolP("show-origin", "o", false, "Show origin") + infoCmd.Flags().BoolP("show-permissions", "M", false, "Show permissions") + infoCmd.Flags().BoolP("show-ref", "r", false, "Show ref") + infoCmd.Flags().Bool("show-runtime", false, "Show runtime") + infoCmd.Flags().Bool("show-sdk", false, "Show sdk") + infoCmd.Flags().BoolP("show-size", "s", false, "Show size") + infoCmd.Flags().Bool("system", false, "Show system-wide installations") + infoCmd.Flags().Bool("user", false, "Show user installations") + infoCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(infoCmd) + + // TODO flag + carapace.Gen(infoCmd).FlagCompletion(carapace.ActionMap{ + "arch": flatpak.ActionArches(), + // "file-access": carapace.ActionValues(), + // "installation": carapace.ActionValues(), + }) + + carapace.Gen(infoCmd).PositionalCompletion( + flatpak.ActionApplications(), // TODO runtimes?? + // TODO branches + ) +} diff --git a/completers/flatpak_completer/cmd/install.go b/completers/flatpak_completer/cmd/install.go new file mode 100644 index 0000000000..0b724c0c80 --- /dev/null +++ b/completers/flatpak_completer/cmd/install.go @@ -0,0 +1,58 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var installCmd = &cobra.Command{ + Use: "install", + Short: "Install an application or runtime", + GroupID: "install", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(installCmd).Standalone() + + installCmd.Flags().Bool("app", false, "Look for app with the specified name") + installCmd.Flags().String("arch", "", "Arch to install for") + installCmd.Flags().BoolP("assumeyes", "y", false, "Automatically answer yes for all questions") + installCmd.Flags().Bool("bundle", false, "Assume LOCATION is a .flatpak single-file bundle") + installCmd.Flags().Bool("from", false, "Assume LOCATION is a .flatpakref application description") + installCmd.Flags().String("gpg-file", "", "Check bundle signatures with GPG key from FILE (- for stdin)") + installCmd.Flags().BoolP("help", "h", false, "Show help options") + installCmd.Flags().Bool("include-debug", false, "Additionally install the debug info for the given refs and their dependencies") + installCmd.Flags().Bool("include-sdk", false, "Additionally install the SDK used to build the given refs") + installCmd.Flags().String("installation", "", "Work on a non-default system-wide installation") + installCmd.Flags().Bool("no-auto-pin", false, "Don't automatically pin explicit installs") + installCmd.Flags().Bool("no-deploy", false, "Don't deploy, only download to local cache") + installCmd.Flags().Bool("no-deps", false, "Don't verify/install runtime dependencies") + installCmd.Flags().Bool("no-pull", false, "Don't pull, only install from local cache") + installCmd.Flags().Bool("no-related", false, "Don't install related refs") + installCmd.Flags().Bool("no-static-deltas", false, "Don't use static deltas") + installCmd.Flags().Bool("noninteractive", false, "Produce minimal output and don't ask questions") + installCmd.Flags().Bool("or-update", false, "Update install if already installed") + installCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + installCmd.Flags().Bool("reinstall", false, "Uninstall first if already installed") + installCmd.Flags().Bool("runtime", false, "Look for runtime with the specified name") + installCmd.Flags().String("sideload-repo", "", "Use this local repo for sideloads") + installCmd.Flags().String("subpath", "", "Only install this subpath") + installCmd.Flags().Bool("system", false, "Work on the system-wide installation (default)") + installCmd.Flags().BoolP("user", "u", false, "Work on the user installation") + installCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(installCmd) + + carapace.Gen(installCmd).FlagCompletion(carapace.ActionMap{ + "arch": flatpak.ActionArches(), + "gpg-file": carapace.ActionFiles(), + // "installation": carapace.ActionValues(), TODO + "sideload-repo": carapace.ActionFiles(), + // "subpath": carapace.ActionValues(), TODO + }) + + carapace.Gen(installCmd).PositionalAnyCompletion( + flatpak.ActionApplicationSearch().FilterArgs(), + ) +} diff --git a/completers/flatpak_completer/cmd/kill.go b/completers/flatpak_completer/cmd/kill.go new file mode 100644 index 0000000000..59c9a4e5df --- /dev/null +++ b/completers/flatpak_completer/cmd/kill.go @@ -0,0 +1,24 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var killCmd = &cobra.Command{ + Use: "kill [OPTION…] INSTANCE", + Short: "Stop a running application", + GroupID: "run", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(killCmd).Standalone() + + killCmd.Flags().BoolP("help", "h", false, "Show help options") + killCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + killCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(killCmd) + + // TODO positional +} diff --git a/completers/flatpak_completer/cmd/list.go b/completers/flatpak_completer/cmd/list.go new file mode 100644 index 0000000000..f1c9db98c2 --- /dev/null +++ b/completers/flatpak_completer/cmd/list.go @@ -0,0 +1,41 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var listCmd = &cobra.Command{ + Use: "list [OPTION…]", + Short: "List installed apps and/or runtimes", + GroupID: "install", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(listCmd).Standalone() + + listCmd.Flags().BoolP("all", "a", false, "List all refs (including locale/debug)") + listCmd.Flags().Bool("app", false, "List installed applications") + listCmd.Flags().String("app-runtime", "", "List all applications using RUNTIME") + listCmd.Flags().String("arch", "", "Arch to show") + listCmd.Flags().String("columns", "", "What information to show") + listCmd.Flags().BoolP("help", "h", false, "Show help options") + listCmd.Flags().String("installation", "", "Work on a non-default system-wide installation") + listCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + listCmd.Flags().Bool("runtime", false, "List installed runtimes") + listCmd.Flags().BoolP("show-details", "d", false, "Show extra information") + listCmd.Flags().Bool("system", false, "Work on the system-wide installation (default)") + listCmd.Flags().BoolP("user", "u", false, "Work on the user installation") + listCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(listCmd) + + // TODO flags + carapace.Gen(listCmd).FlagCompletion(carapace.ActionMap{ + // "app-runtime": carapace.ActionValues(), + "arch": flatpak.ActionArches(), + "columns": columns(flatpak.ActionApplicationColumns()), + // "installation": carapace.ActionValues(), + }) +} diff --git a/completers/flatpak_completer/cmd/makeCurrent.go b/completers/flatpak_completer/cmd/makeCurrent.go new file mode 100644 index 0000000000..40793bf9ef --- /dev/null +++ b/completers/flatpak_completer/cmd/makeCurrent.go @@ -0,0 +1,32 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var makeCurrentCmd = &cobra.Command{ + Use: "make-current", + Short: "Make branch of application current", + GroupID: "run", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(makeCurrentCmd).Standalone() + + makeCurrentCmd.Flags().String("arch", "", "Arch to make current for") + makeCurrentCmd.Flags().BoolP("help", "h", false, "Show help options") + makeCurrentCmd.Flags().String("installation", "", "Work on a non-default system-wide installation") + makeCurrentCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + makeCurrentCmd.Flags().Bool("system", false, "Work on the system-wide installation (default)") + makeCurrentCmd.Flags().BoolP("user", "u", false, "Work on the user installation") + makeCurrentCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(makeCurrentCmd) + + carapace.Gen(makeCurrentCmd).FlagCompletion(carapace.ActionMap{ + "arch": flatpak.ActionArches(), + // "installation": carapace.ActionValues(), + }) +} diff --git a/completers/flatpak_completer/cmd/mask.go b/completers/flatpak_completer/cmd/mask.go new file mode 100644 index 0000000000..1ea1ac7a9f --- /dev/null +++ b/completers/flatpak_completer/cmd/mask.go @@ -0,0 +1,28 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var maskCmd = &cobra.Command{ + Use: "mask", + Short: "disable updates and automatic installation matching patterns", + GroupID: "install", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(maskCmd).Standalone() + + maskCmd.Flags().BoolP("help", "h", false, "Show help options") + maskCmd.Flags().String("installation", "", "Work on a non-default system-wide installation") + maskCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + maskCmd.Flags().Bool("remove", false, "Remove matching masks") + maskCmd.Flags().Bool("system", false, "Work on the system-wide installation (default)") + maskCmd.Flags().BoolP("user", "u", false, "Work on the user installation") + maskCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(maskCmd) + + // TODO flag +} diff --git a/completers/flatpak_completer/cmd/override.go b/completers/flatpak_completer/cmd/override.go new file mode 100644 index 0000000000..db84b6c5a4 --- /dev/null +++ b/completers/flatpak_completer/cmd/override.go @@ -0,0 +1,82 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var overrideCmd = &cobra.Command{ + Use: "override [OPTION…] [APP]", + Short: "Override settings [for application]", + GroupID: "run", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(overrideCmd).Standalone() + + overrideCmd.Flags().String("add-policy", "", "Add generic policy option") + overrideCmd.Flags().String("allow", "", "Allow feature") + overrideCmd.Flags().String("device", "", "Expose device to app") + overrideCmd.Flags().String("disallow", "", "Don't allow feature") + overrideCmd.Flags().String("env", "", "Set environment variable") + overrideCmd.Flags().String("env-fd", "", "Read environment variables in env -0 format from FD") + overrideCmd.Flags().String("filesystem", "", "Expose filesystem to app (:ro for read-only)") + overrideCmd.Flags().BoolP("help", "h", false, "Show help options") + overrideCmd.Flags().Bool("help-all", false, "Show all help options") + overrideCmd.Flags().String("installation", "", "Work on a non-default system-wide installation") + overrideCmd.Flags().String("no-talk-name", "", "Don't allow app to talk to name on the session bus") + overrideCmd.Flags().String("nodevice", "", "Don't expose device to app") + overrideCmd.Flags().String("nofilesystem", "", "Don't expose filesystem to app") + overrideCmd.Flags().String("nosocket", "", "Don't expose socket to app") + overrideCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + overrideCmd.Flags().String("own-name", "", "Allow app to own name on the session bus") + overrideCmd.Flags().String("persist", "", "Persist home directory subpath") + overrideCmd.Flags().String("remove-policy", "", "Remove generic policy option") + overrideCmd.Flags().Bool("reset", false, "Remove existing overrides") + overrideCmd.Flags().String("share", "", "Share with host") + overrideCmd.Flags().Bool("show", false, "Show existing overrides") + overrideCmd.Flags().String("socket", "", "Expose socket to app") + overrideCmd.Flags().Bool("system", false, "Work on the system-wide installation (default)") + overrideCmd.Flags().String("system-no-talk-name", "", "Don't allow app to talk to name on the system bus") + overrideCmd.Flags().String("system-own-name", "", "Allow app to own name on the system bus") + overrideCmd.Flags().String("system-talk-name", "", "Allow app to talk to name on the system bus") + overrideCmd.Flags().String("talk-name", "", "Allow app to talk to name on the session bus") + overrideCmd.Flags().String("unset-env", "", "Remove variable from environment") + overrideCmd.Flags().String("unshare", "", "Unshare with host") + overrideCmd.Flags().BoolP("user", "u", false, "Work on the user installation") + overrideCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(overrideCmd) + + // TODO flags + carapace.Gen(overrideCmd).FlagCompletion(carapace.ActionMap{ + // "add-policy": carapace.ActionValues(), + // "allow": carapace.ActionValues(), + // "device": carapace.ActionValues(), + // "disallow": carapace.ActionValues(), + // "env": carapace.ActionValues(), + // "env-fd": carapace.ActionValues(), + // "filesystem": carapace.ActionValues(), + // "installation": carapace.ActionValues(), + // "no-talk-name": carapace.ActionValues(), + // "nodevice": carapace.ActionValues(), + // "nofilesystem": carapace.ActionValues(), + // "nosocket": carapace.ActionValues(), + // "own-name": carapace.ActionValues(), + // "persist": carapace.ActionValues(), + // "remove-policy": carapace.ActionValues(), + // "share": carapace.ActionValues(), + // "socket": carapace.ActionValues(), + // "system-no-talk-name": carapace.ActionValues(), + // "system-own-name": carapace.ActionValues(), + // "system-talk-name": carapace.ActionValues(), + // "talk-name": carapace.ActionValues(), + // "unset-env": carapace.ActionValues(), + // "unshare": carapace.ActionValues(), + }) + + carapace.Gen(overrideCmd).PositionalCompletion( + flatpak.ActionApplications(), + ) +} diff --git a/completers/flatpak_completer/cmd/permissionRemove.go b/completers/flatpak_completer/cmd/permissionRemove.go new file mode 100644 index 0000000000..4d4306e7b6 --- /dev/null +++ b/completers/flatpak_completer/cmd/permissionRemove.go @@ -0,0 +1,29 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var permissionRemoveCmd = &cobra.Command{ + Use: "permission-remove [OPTION…] TABLE ID [APP_ID]", + Short: "Remove item from permission store", + GroupID: "permission", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(permissionRemoveCmd).Standalone() + + permissionRemoveCmd.Flags().BoolP("help", "h", false, "Show help options") + permissionRemoveCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + permissionRemoveCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(permissionRemoveCmd) + + carapace.Gen(permissionRemoveCmd).PositionalCompletion( + carapace.ActionValues(), // TODO table + carapace.ActionValues(), // TODO id + flatpak.ActionApplications(), + ) +} diff --git a/completers/flatpak_completer/cmd/permissionReset.go b/completers/flatpak_completer/cmd/permissionReset.go new file mode 100644 index 0000000000..f77a52f05e --- /dev/null +++ b/completers/flatpak_completer/cmd/permissionReset.go @@ -0,0 +1,28 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var permissionResetCmd = &cobra.Command{ + Use: "permission-reset [OPTION…] APP_ID", + Short: "Reset permissions for an app", + GroupID: "permission", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(permissionResetCmd).Standalone() + + permissionResetCmd.Flags().Bool("all", false, "Reset all permissions") + permissionResetCmd.Flags().BoolP("help", "h", false, "Show help options") + permissionResetCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + permissionResetCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(permissionResetCmd) + + carapace.Gen(permissionResetCmd).PositionalCompletion( + flatpak.ActionApplications(), + ) +} diff --git a/completers/flatpak_completer/cmd/permissionSet.go b/completers/flatpak_completer/cmd/permissionSet.go new file mode 100644 index 0000000000..227cf47621 --- /dev/null +++ b/completers/flatpak_completer/cmd/permissionSet.go @@ -0,0 +1,32 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var permissionSetCmd = &cobra.Command{ + Use: "permission-set [OPTION…] TABLE ID APP_ID [PERMISSION...]", + Short: "Set permissions", + GroupID: "permission", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(permissionSetCmd).Standalone() + + permissionSetCmd.Flags().String("data", "", "Associate DATA with the entry") + permissionSetCmd.Flags().BoolP("help", "h", false, "Show help options") + permissionSetCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + permissionSetCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(permissionSetCmd) + + carapace.Gen(permissionSetCmd).PositionalCompletion( + carapace.ActionValues(), // TODO table + carapace.ActionValues(), // TODO id + flatpak.ActionApplications(), + ) + + // TODO permissions +} diff --git a/completers/flatpak_completer/cmd/permissionShow.go b/completers/flatpak_completer/cmd/permissionShow.go new file mode 100644 index 0000000000..eacbde546e --- /dev/null +++ b/completers/flatpak_completer/cmd/permissionShow.go @@ -0,0 +1,27 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var permissionShowCmd = &cobra.Command{ + Use: "permission-show [OPTION…] APP_ID", + Short: "Show permissions for an app", + GroupID: "permission", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(permissionShowCmd).Standalone() + + permissionShowCmd.Flags().BoolP("help", "h", false, "Show help options") + permissionShowCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + permissionShowCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(permissionShowCmd) + + carapace.Gen(permissionShowCmd).PositionalCompletion( + flatpak.ActionApplications(), + ) +} diff --git a/completers/flatpak_completer/cmd/permissions.go b/completers/flatpak_completer/cmd/permissions.go new file mode 100644 index 0000000000..1f2e4b8f8c --- /dev/null +++ b/completers/flatpak_completer/cmd/permissions.go @@ -0,0 +1,24 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var permissionsCmd = &cobra.Command{ + Use: "permissions", + Short: "List permissions", + GroupID: "permission", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(permissionsCmd).Standalone() + + permissionsCmd.Flags().BoolP("help", "h", false, "Show help options") + permissionsCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + permissionsCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(permissionsCmd) + + // TODO positional +} diff --git a/completers/flatpak_completer/cmd/pin.go b/completers/flatpak_completer/cmd/pin.go new file mode 100644 index 0000000000..6a407e9a59 --- /dev/null +++ b/completers/flatpak_completer/cmd/pin.go @@ -0,0 +1,28 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var pinCmd = &cobra.Command{ + Use: "pin [OPTION…] [PATTERN…]", + Short: "disable automatic removal of runtimes matching patterns", + GroupID: "install", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(pinCmd).Standalone() + + pinCmd.Flags().BoolP("help", "h", false, "Show help options") + pinCmd.Flags().String("installation", "", "Work on a non-default system-wide installation") + pinCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + pinCmd.Flags().Bool("remove", false, "Remove matching pins") + pinCmd.Flags().Bool("system", false, "Work on the system-wide installation (default)") + pinCmd.Flags().BoolP("user", "u", false, "Work on the user installation") + pinCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(pinCmd) + + // TODO flag +} diff --git a/completers/flatpak_completer/cmd/ps.go b/completers/flatpak_completer/cmd/ps.go new file mode 100644 index 0000000000..2adcb5f558 --- /dev/null +++ b/completers/flatpak_completer/cmd/ps.go @@ -0,0 +1,28 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var psCmd = &cobra.Command{ + Use: "ps", + Short: "Enumerate running sandboxes", + GroupID: "run", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(psCmd).Standalone() + + psCmd.Flags().String("columns", "", "What information to show") + psCmd.Flags().BoolP("help", "h", false, "Show help options") + psCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + psCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(psCmd) + + carapace.Gen(psCmd).FlagCompletion(carapace.ActionMap{ + "columns": columns(flatpak.ActionProcessColums()), + }) +} diff --git a/completers/flatpak_completer/cmd/remoteAdd.go b/completers/flatpak_completer/cmd/remoteAdd.go new file mode 100644 index 0000000000..cb59c19cde --- /dev/null +++ b/completers/flatpak_completer/cmd/remoteAdd.go @@ -0,0 +1,81 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/git" + "github.com/spf13/cobra" +) + +var remoteAddCmd = &cobra.Command{ + Use: "remote-add [OPTION…] NAME LOCATION", + Short: "Add a remote repository", + GroupID: "repository", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(remoteAddCmd).Standalone() + + remoteAddCmd.Flags().Bool("authenticator-install", false, "Autoinstall authenticator") + remoteAddCmd.Flags().String("authenticator-name", "", "Name of authenticator") + remoteAddCmd.Flags().String("authenticator-option", "", "Authenticator option") + remoteAddCmd.Flags().String("collection-id", "", "Collection ID") + remoteAddCmd.Flags().String("comment", "", "A one-line comment for this remote") + remoteAddCmd.Flags().String("default-branch", "", "Default branch to use for this remote") + remoteAddCmd.Flags().String("description", "", "A full-paragraph description for this remote") + remoteAddCmd.Flags().Bool("disable", false, "Disable the remote") + remoteAddCmd.Flags().String("filter", "", "Set path to local filter FILE") + remoteAddCmd.Flags().Bool("from", false, "LOCATION specifies a configuration file, not the repo location") + remoteAddCmd.Flags().String("gpg-import", "", "Import GPG key from FILE (- for stdin)") + remoteAddCmd.Flags().BoolP("help", "h", false, "Show help options") + remoteAddCmd.Flags().String("homepage", "", "URL for a website for this remote") + remoteAddCmd.Flags().String("icon", "", "URL for an icon for this remote") + remoteAddCmd.Flags().Bool("if-not-exists", false, "Do nothing if the provided remote exists") + remoteAddCmd.Flags().String("installation", "", "Work on a non-default system-wide installation") + remoteAddCmd.Flags().Bool("no-authenticator-install", false, "Don't autoinstall authenticator") + remoteAddCmd.Flags().Bool("no-enumerate", false, "Mark the remote as don't enumerate") + remoteAddCmd.Flags().Bool("no-follow_redirect", false, "Don't follow the redirect set in the summary file") + remoteAddCmd.Flags().Bool("no-gpg-verify", false, "Disable GPG verification") + remoteAddCmd.Flags().Bool("no-use-for-deps", false, "Mark the remote as don't use for deps") + remoteAddCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + remoteAddCmd.Flags().String("prio", "", "Set priority (default 1, higher is more prioritized)") + remoteAddCmd.Flags().String("subset", "", "The named subset to use for this remote") + remoteAddCmd.Flags().Bool("system", false, "Work on the system-wide installation (default)") + remoteAddCmd.Flags().String("title", "", "A nice name to use for this remote") + remoteAddCmd.Flags().BoolP("user", "u", false, "Work on the user installation") + remoteAddCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(remoteAddCmd) + + // TODO flags + carapace.Gen(remoteAddCmd).FlagCompletion(carapace.ActionMap{ + // "authenticator-name": carapace.ActionValues(), + // "authenticator-option": carapace.ActionValues(), + // "collection-id": carapace.ActionValues(), + // "comment": carapace.ActionValues(), + "default-branch": carapace.ActionCallback(func(c carapace.Context) carapace.Action { + if len(c.Args) < 2 || remoteAddCmd.Flag("from").Changed { + return carapace.ActionValues() + } + return git.ActionLsRemoteRefs(git.LsRemoteRefOption{Url: c.Args[1], Branches: true}) + }), + // "description": carapace.ActionValues(), + "filter": carapace.ActionFiles(), + "gpg-import": carapace.ActionFiles(), + // "homepage": carapace.ActionValues(), + // "icon": carapace.ActionValues(), + // "installation": carapace.ActionValues(), + // "prio": carapace.ActionValues(), + // "subset": carapace.ActionValues(), + // "title": carapace.ActionValues(), + }) + + carapace.Gen(remoteAddCmd).PositionalCompletion( + carapace.ActionValues(), + carapace.ActionCallback(func(c carapace.Context) carapace.Action { + if remoteAddCmd.Flag("from").Changed { + return carapace.ActionFiles() + } + return git.ActionRepositorySearch(git.SearchOpts{}.Default()) + }), + ) +} diff --git a/completers/flatpak_completer/cmd/remoteDelete.go b/completers/flatpak_completer/cmd/remoteDelete.go new file mode 100644 index 0000000000..591cd3ee3b --- /dev/null +++ b/completers/flatpak_completer/cmd/remoteDelete.go @@ -0,0 +1,30 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var remoteDeleteCmd = &cobra.Command{ + Use: "remote-delete [OPTION…] NAME", + Short: "Delete a remote repository", + GroupID: "repository", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(remoteDeleteCmd).Standalone() + + remoteDeleteCmd.Flags().Bool("force", false, "Remove remote even if in use") + remoteDeleteCmd.Flags().BoolP("help", "h", false, "Show help options") + remoteDeleteCmd.Flags().String("installation", "", "Work on a non-default system-wide installation") + remoteDeleteCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + remoteDeleteCmd.Flags().Bool("system", false, "Work on the system-wide installation (default)") + remoteDeleteCmd.Flags().BoolP("user", "u", false, "Work on the user installation") + remoteDeleteCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(remoteDeleteCmd) + + // TODO flag + + // TODO positonal +} diff --git a/completers/flatpak_completer/cmd/remoteInfo.go b/completers/flatpak_completer/cmd/remoteInfo.go new file mode 100644 index 0000000000..d11d5c7fa0 --- /dev/null +++ b/completers/flatpak_completer/cmd/remoteInfo.go @@ -0,0 +1,48 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var remoteInfoCmd = &cobra.Command{ + Use: "remote-info [OPTION…] REMOTE REF", + Short: "Show information about an application or runtime in a remote", + GroupID: "repository", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(remoteInfoCmd).Standalone() + + remoteInfoCmd.Flags().Bool("app", false, "Look for app with the specified name") + remoteInfoCmd.Flags().String("arch", "", "Arch to install for") + remoteInfoCmd.Flags().Bool("cached", false, "Use local caches even if they are stale") + remoteInfoCmd.Flags().String("commit", "", "Commit to show info for") + remoteInfoCmd.Flags().BoolP("help", "h", false, "Show help options") + remoteInfoCmd.Flags().String("installation", "", "Work on a non-default system-wide installation") + remoteInfoCmd.Flags().Bool("log", false, "Display log") + remoteInfoCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + remoteInfoCmd.Flags().Bool("runtime", false, "Look for runtime with the specified name") + remoteInfoCmd.Flags().BoolP("show-commit", "c", false, "Show commit") + remoteInfoCmd.Flags().BoolP("show-metadata", "m", false, "Show metadata") + remoteInfoCmd.Flags().BoolP("show-parent", "p", false, "Show parent") + remoteInfoCmd.Flags().BoolP("show-ref", "r", false, "Show ref") + remoteInfoCmd.Flags().Bool("show-runtime", false, "Show runtime") + remoteInfoCmd.Flags().Bool("show-sdk", false, "Show sdk") + remoteInfoCmd.Flags().Bool("sideloaded", false, "Only list refs available as sideloads") + remoteInfoCmd.Flags().Bool("system", false, "Work on the system-wide installation (default)") + remoteInfoCmd.Flags().BoolP("user", "u", false, "Work on the user installation") + remoteInfoCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(remoteInfoCmd) + + /// TODO flag + carapace.Gen(remoteInfoCmd).FlagCompletion(carapace.ActionMap{ + "arch": flatpak.ActionArches(), + // "commit": carapace.ActionValues(), + // "installation": carapace.ActionValues(), + }) + + // TODO positional +} diff --git a/completers/flatpak_completer/cmd/remoteLs.go b/completers/flatpak_completer/cmd/remoteLs.go new file mode 100644 index 0000000000..164ffd3e8a --- /dev/null +++ b/completers/flatpak_completer/cmd/remoteLs.go @@ -0,0 +1,46 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var remoteLsCmd = &cobra.Command{ + Use: "remote-ls [OPTION…] [REMOTE or URI]", + Short: "Show available runtimes and applications", + GroupID: "repository", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(remoteLsCmd).Standalone() + + remoteLsCmd.Flags().BoolP("all", "a", false, "List all refs (including locale/debug)") + remoteLsCmd.Flags().Bool("app", false, "Show only apps") + remoteLsCmd.Flags().String("app-runtime", "", "List all applications using RUNTIME") + remoteLsCmd.Flags().String("arch", "", "Limit to this arch (* for all)") + remoteLsCmd.Flags().Bool("cached", false, "Use local caches even if they are stale") + remoteLsCmd.Flags().String("columns", "", "What information to show") + remoteLsCmd.Flags().BoolP("help", "h", false, "Show help options") + remoteLsCmd.Flags().String("installation", "", "Work on a non-default system-wide installation") + remoteLsCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + remoteLsCmd.Flags().Bool("runtime", false, "Show only runtimes") + remoteLsCmd.Flags().BoolP("show-details", "d", false, "Show arches and branches") + remoteLsCmd.Flags().Bool("sideloaded", false, "Only list refs available as sideloads") + remoteLsCmd.Flags().Bool("system", false, "Work on the system-wide installation (default)") + remoteLsCmd.Flags().Bool("updates", false, "Show only those where updates are available") + remoteLsCmd.Flags().BoolP("user", "u", false, "Work on the user installation") + remoteLsCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(remoteLsCmd) + + // TODO flag + carapace.Gen(remoteLsCmd).FlagCompletion(carapace.ActionMap{ + // "app-runtime": carapace.ActionValues(), + "arch": flatpak.ActionArches(), + "columns": columns(flatpak.ActionRemoteContentColumns()), + // "installation": carapace.ActionValues(), + }) + + // TODO positional +} diff --git a/completers/flatpak_completer/cmd/remoteModify.go b/completers/flatpak_completer/cmd/remoteModify.go new file mode 100644 index 0000000000..6efe79c56d --- /dev/null +++ b/completers/flatpak_completer/cmd/remoteModify.go @@ -0,0 +1,74 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var remoteModifyCmd = &cobra.Command{ + Use: "remote-modify [OPTION…] NAME", + Short: "Modify a remote repository", + GroupID: "repository", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(remoteModifyCmd).Standalone() + + remoteModifyCmd.Flags().Bool("authenticator-install", false, "Autoinstall authenticator") + remoteModifyCmd.Flags().String("authenticator-name", "", "Name of authenticator") + remoteModifyCmd.Flags().String("authenticator-option", "", "Authenticator options") + remoteModifyCmd.Flags().String("collection-id", "", "Collection ID") + remoteModifyCmd.Flags().String("comment", "", "A one-line comment for this remote") + remoteModifyCmd.Flags().String("default-branch", "", "Default branch to use for this remote") + remoteModifyCmd.Flags().String("description", "", "A full-paragraph description for this remote") + remoteModifyCmd.Flags().Bool("disable", false, "Disable the remote") + remoteModifyCmd.Flags().Bool("enable", false, "Enable the remote") + remoteModifyCmd.Flags().Bool("enumerate", false, "Mark the remote as enumerate") + remoteModifyCmd.Flags().String("filter", "", "Set path to local filter FILE") + remoteModifyCmd.Flags().Bool("follow-redirect", false, "Follow the redirect set in the summary file") + remoteModifyCmd.Flags().String("gpg-import", "", "Import GPG key from FILE (- for stdin)") + remoteModifyCmd.Flags().Bool("gpg-verify", false, "Enable GPG verification") + remoteModifyCmd.Flags().BoolP("help", "h", false, "Show help options") + remoteModifyCmd.Flags().String("homepage", "", "URL for a website for this remote") + remoteModifyCmd.Flags().String("icon", "", "URL for an icon for this remote") + remoteModifyCmd.Flags().String("installation", "", "Work on a non-default system-wide installation") + remoteModifyCmd.Flags().Bool("no-authenticator-install", false, "Don't autoinstall authenticator") + remoteModifyCmd.Flags().Bool("no-enumerate", false, "Mark the remote as don't enumerate") + remoteModifyCmd.Flags().Bool("no-filter", false, "Disable local filter") + remoteModifyCmd.Flags().Bool("no-follow-redirect", false, "Don't follow the redirect set in the summary file") + remoteModifyCmd.Flags().Bool("no-gpg-verify", false, "Disable GPG verification") + remoteModifyCmd.Flags().Bool("no-use-for-deps", false, "Mark the remote as don't use for deps") + remoteModifyCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + remoteModifyCmd.Flags().String("prio", "", "Set priority (default 1, higher is more prioritized)") + remoteModifyCmd.Flags().String("subset", "", "Set a new subset to use") + remoteModifyCmd.Flags().Bool("system", false, "Work on the system-wide installation (default)") + remoteModifyCmd.Flags().String("title", "", "A nice name to use for this remote") + remoteModifyCmd.Flags().Bool("update-metadata", false, "Update extra metadata from the summary file") + remoteModifyCmd.Flags().String("url", "", "Set a new url") + remoteModifyCmd.Flags().Bool("use-for-deps", false, "Mark the remote as used for dependencies") + remoteModifyCmd.Flags().BoolP("user", "u", false, "Work on the user installation") + remoteModifyCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(remoteModifyCmd) + + // TODO flags + carapace.Gen(remoteModifyCmd).FlagCompletion(carapace.ActionMap{ + // "authenticator-name": carapace.ActionValues(), + // "authenticator-option": carapace.ActionValues(), + // "collection-id": carapace.ActionValues(), + // "comment": carapace.ActionValues(), + // "default-branch": carapace.ActionValues(), + // "description": carapace.ActionValues(), + // "filter": carapace.ActionValues(), + // "gpg-import": carapace.ActionValues(), + // "homepage": carapace.ActionValues(), + // "icon": carapace.ActionValues(), + // "installation": carapace.ActionValues(), + // "prio": carapace.ActionValues(), + // "subset": carapace.ActionValues(), + // "title": carapace.ActionValues(), + // "url": carapace.ActionValues(), + }) + + // TODO positional +} diff --git a/completers/flatpak_completer/cmd/remotes.go b/completers/flatpak_completer/cmd/remotes.go new file mode 100644 index 0000000000..921224e8ff --- /dev/null +++ b/completers/flatpak_completer/cmd/remotes.go @@ -0,0 +1,34 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var remotesCmd = &cobra.Command{ + Use: "remotes [OPTION…]", + Short: "List remote repositories", + GroupID: "repository", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(remotesCmd).Standalone() + + remotesCmd.Flags().String("columns", "", "What information to show") + remotesCmd.Flags().BoolP("help", "h", false, "Show help options") + remotesCmd.Flags().String("installation", "", "Work on a non-default system-wide installation") + remotesCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + remotesCmd.Flags().BoolP("show-details", "d", false, "Show remote details") + remotesCmd.Flags().Bool("show-disabled", false, "Show disabled remotes") + remotesCmd.Flags().Bool("system", false, "Work on the system-wide installation (default)") + remotesCmd.Flags().BoolP("user", "u", false, "Work on the user installation") + remotesCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(remotesCmd) + + carapace.Gen(remotesCmd).FlagCompletion(carapace.ActionMap{ + "columns": columns(flatpak.ActionRemoteColumns()), + "installation": carapace.ActionValues(), // TODO + }) +} diff --git a/completers/flatpak_completer/cmd/repair.go b/completers/flatpak_completer/cmd/repair.go new file mode 100644 index 0000000000..e88df0f86b --- /dev/null +++ b/completers/flatpak_completer/cmd/repair.go @@ -0,0 +1,29 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var repairCmd = &cobra.Command{ + Use: "repair [OPTION…]", + Short: "Repair a flatpak installation", + GroupID: "install", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(repairCmd).Standalone() + + repairCmd.Flags().Bool("dry-run", false, "Don't make any changes") + repairCmd.Flags().BoolP("help", "h", false, "Show help options") + repairCmd.Flags().String("installation", "", "Work on a non-default system-wide installation") + repairCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + repairCmd.Flags().Bool("reinstall-all", false, "Reinstall all refs") + repairCmd.Flags().Bool("system", false, "Work on the system-wide installation (default)") + repairCmd.Flags().BoolP("user", "u", false, "Work on the user installation") + repairCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(repairCmd) + + // TODO flag +} diff --git a/completers/flatpak_completer/cmd/repo.go b/completers/flatpak_completer/cmd/repo.go new file mode 100644 index 0000000000..50715eda06 --- /dev/null +++ b/completers/flatpak_completer/cmd/repo.go @@ -0,0 +1,36 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var repoCmd = &cobra.Command{ + Use: "repo [OPTION…] LOCATION", + Short: "Repository maintenance", + GroupID: "build", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(repoCmd).Standalone() + + repoCmd.Flags().Bool("branches", false, "List the branches in the repository") + repoCmd.Flags().String("commits", "", "Show commits for a branch") + repoCmd.Flags().BoolP("help", "h", false, "Show help options") + repoCmd.Flags().Bool("info", false, "Print general information about the repository") + repoCmd.Flags().String("metadata", "", "Print metadata for a branch") + repoCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + repoCmd.Flags().Bool("subset", false, "Limit information to subsets with this prefix") + repoCmd.Flags().Bool("subsets", false, "Print information about the repo subsets") + repoCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(repoCmd) + + // TODO flag + carapace.Gen(repoCmd).FlagCompletion(carapace.ActionMap{ + // "commits" + // "metadata" + }) + + // TODO positional +} diff --git a/completers/flatpak_completer/cmd/root.go b/completers/flatpak_completer/cmd/root.go new file mode 100644 index 0000000000..49dca8fa2b --- /dev/null +++ b/completers/flatpak_completer/cmd/root.go @@ -0,0 +1,57 @@ +package cmd + +import ( + "strings" + + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var rootCmd = &cobra.Command{ + Use: "flatpak", + Short: "Linux application sandboxing and distribution framework", + Long: "https://flatpak.org/", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func Execute() error { + return rootCmd.Execute() +} +func init() { + carapace.Gen(rootCmd).Standalone() + + rootCmd.AddGroup( + &cobra.Group{ID: "install", Title: "Manage installed applications and runtimes"}, + &cobra.Group{ID: "search", Title: "Find applications and runtimes"}, + &cobra.Group{ID: "run", Title: "Manage running applications"}, + &cobra.Group{ID: "access", Title: "Manage file access"}, + &cobra.Group{ID: "permission", Title: "Manage dynamic permissions"}, + &cobra.Group{ID: "repository", Title: "Manage remote repositories"}, + &cobra.Group{ID: "build", Title: "Build applications"}, + ) + + rootCmd.Flags().Bool("default-arch", false, "Print default arch and exit") + rootCmd.Flags().Bool("gl-drivers", false, "Print active gl drivers and exit") + rootCmd.Flags().BoolP("help", "h", false, "Show help options") + rootCmd.Flags().Bool("installations", false, "Print paths for system installations and exit") + rootCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + rootCmd.Flags().Bool("print-system-only", false, "Only include the system installation with --print-updated-env") + rootCmd.Flags().Bool("print-updated-env", false, "Print the updated environment needed to run flatpaks") + rootCmd.Flags().Bool("supported-arches", false, "Print supported arches and exit") + rootCmd.Flags().CountP("verbose", "v", "Show debug information, -vv for more detail") + rootCmd.Flags().Bool("version", false, "Print version information and exit") +} + +func columns(a carapace.Action) carapace.Action { + return carapace.ActionMultiPartsN(":", 2, func(c carapace.Context) carapace.Action { + switch len(c.Parts) { + case 0: + return a + default: + return flatpak.ActionEllipsizations() + } + }).UniqueListF(",", func(s string) string { + return strings.SplitN(s, ":", 2)[0] + }) +} diff --git a/completers/flatpak_completer/cmd/run.go b/completers/flatpak_completer/cmd/run.go new file mode 100644 index 0000000000..6d4be61f07 --- /dev/null +++ b/completers/flatpak_completer/cmd/run.go @@ -0,0 +1,118 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var runCmd = &cobra.Command{ + Use: "run [OPTION…] APP [ARGUMENT…]", + Short: "Run an app", + GroupID: "run", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(runCmd).Standalone() + runCmd.Flags().SetInterspersed(false) + + runCmd.Flags().Bool("a11y-bus", false, "Proxy accessibility bus calls (default except when sandboxed)") + runCmd.Flags().String("add-policy", "", "Add generic policy option") + runCmd.Flags().String("allow", "", "Allow feature") + runCmd.Flags().String("app-path", "", "Use PATH instead of the app's /app") + runCmd.Flags().String("arch", "", "Arch to use") + runCmd.Flags().String("branch", "", "Branch to use") + runCmd.Flags().String("command", "", "Command to run") + runCmd.Flags().Bool("commit", false, "Run specified commit") + runCmd.Flags().String("cwd", "", "Directory to run the command in") + runCmd.Flags().BoolP("devel", "d", false, "Use development runtime") + runCmd.Flags().String("device", "", "Expose device to app") + runCmd.Flags().BoolP("die-with-parent", "p", false, "Kill processes when the parent process dies") + runCmd.Flags().String("disallow", "", "Don't allow feature") + runCmd.Flags().String("env", "", "Set environment variable") + runCmd.Flags().String("env-fd", "", "Read environment variables in env -0 format from FD") + runCmd.Flags().Bool("file-forwarding", false, "Enable file forwarding") + runCmd.Flags().String("filesystem", "", "Expose filesystem to app (:ro for read-only)") + runCmd.Flags().BoolP("help", "h", false, "Show help options") + runCmd.Flags().Bool("help-all", false, "Show all help options") + runCmd.Flags().String("installation", "", "Work on a non-default system-wide installation") + runCmd.Flags().Bool("instance-id-fd", false, "Write the instance ID to the given file descriptor") + runCmd.Flags().Bool("log-a11y-bus", false, "Log accessibility bus calls") + runCmd.Flags().Bool("log-session-bus", false, "Log session bus calls") + runCmd.Flags().Bool("log-system-bus", false, "Log system bus calls") + runCmd.Flags().Bool("no-a11y-bus", false, "Don't proxy accessibility bus calls") + runCmd.Flags().Bool("no-documents-portal", false, "Don't start portals") + runCmd.Flags().Bool("no-session-bus", false, "Don't proxy session bus calls") + runCmd.Flags().String("no-talk-name", "", "Don't allow app to talk to name on the session bus") + runCmd.Flags().String("nodevice", "", "Don't expose device to app") + runCmd.Flags().String("nofilesystem", "", "Don't expose filesystem to app") + runCmd.Flags().String("nosocket", "", "Don't expose socket to app") + runCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + runCmd.Flags().String("own-name", "", "Allow app to own name on the session bus") + runCmd.Flags().Bool("parent-expose-pids", false, "Make processes visible in parent namespace") + runCmd.Flags().String("parent-pid", "", "Use PID as parent pid for sharing namespaces") + runCmd.Flags().Bool("parent-share-pids", false, "Share process ID namespace with parent") + runCmd.Flags().String("persist", "", "Persist home directory subpath") + runCmd.Flags().String("remove-policy", "", "Remove generic policy option") + runCmd.Flags().String("runtime", "", "Runtime to use") + runCmd.Flags().Bool("runtime-commit", false, "Use specified runtime commit") + runCmd.Flags().String("runtime-version", "", "Runtime version to use") + runCmd.Flags().Bool("sandbox", false, "Run completely sandboxed") + runCmd.Flags().Bool("session-bus", false, "Proxy session bus calls (default except when sandboxed)") + runCmd.Flags().String("share", "", "Share with host") + runCmd.Flags().String("socket", "", "Expose socket to app") + runCmd.Flags().Bool("system", false, "Work on the system-wide installation (default)") + runCmd.Flags().String("system-no-talk-name", "", "Don't allow app to talk to name on the system bus") + runCmd.Flags().String("system-own-name", "", "Allow app to own name on the system bus") + runCmd.Flags().String("system-talk-name", "", "Allow app to talk to name on the system bus") + runCmd.Flags().String("talk-name", "", "Allow app to talk to name on the session bus") + runCmd.Flags().String("unset-env", "", "Remove variable from environment") + runCmd.Flags().String("unshare", "", "Unshare with host") + runCmd.Flags().BoolP("user", "u", false, "Work on the user installation") + runCmd.Flags().String("usr-path", "", "Use PATH instead of the runtime's /usr") + runCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(runCmd) + + // TODO flags + carapace.Gen(runCmd).FlagCompletion(carapace.ActionMap{ + // "add-policy": carapace.ActionValues(), + // "allow": carapace.ActionValues(), + // "app-path": carapace.ActionValues(), + "arch": flatpak.ActionArches(), + // "branch": carapace.ActionValues(), + // "command": carapace.ActionValues(), + // "cwd": carapace.ActionValues(), + // "device": carapace.ActionValues(), + // "disallow": carapace.ActionValues(), + // "env": carapace.ActionValues(), + // "env-fd": carapace.ActionValues(), + // "filesystem": carapace.ActionValues(), + // "installation": carapace.ActionValues(), + // "no-talk-name": carapace.ActionValues(), + // "nodevice": carapace.ActionValues(), + // "nofilesystem": carapace.ActionValues(), + // "nosocket": carapace.ActionValues(), + // "own-name": carapace.ActionValues(), + // "parent-pid": carapace.ActionValues(), + // "persist": carapace.ActionValues(), + // "remove-policy": carapace.ActionValues(), + // "runtime": carapace.ActionValues(), + // "runtime-version": carapace.ActionValues(), + // "share": carapace.ActionValues(), + // "socket": carapace.ActionValues(), + // "system-no-talk-name": carapace.ActionValues(), + // "system-own-name": carapace.ActionValues(), + // "system-talk-name": carapace.ActionValues(), + // "talk-name": carapace.ActionValues(), + // "unset-env": carapace.ActionValues(), + // "unshare": carapace.ActionValues(), + // "usr-path": carapace.ActionValues(), + }) + + carapace.Gen(runCmd).PositionalCompletion( + flatpak.ActionApplications(), + ) + + // TODO complete arguments for application(c.ARGS[0]) but extend path first so that the flatpak binary is executed in any subsequent dynamic completions +} diff --git a/completers/flatpak_completer/cmd/search.go b/completers/flatpak_completer/cmd/search.go new file mode 100644 index 0000000000..78bf9e6ec3 --- /dev/null +++ b/completers/flatpak_completer/cmd/search.go @@ -0,0 +1,38 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var searchCmd = &cobra.Command{ + Use: "search", + Short: "Search remote apps/runtimes for text", + GroupID: "search", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(searchCmd).Standalone() + + searchCmd.Flags().String("arch", "", "Arch to search for") + searchCmd.Flags().String("columns", "", "What information to show") + searchCmd.Flags().BoolP("help", "h", false, "Show help options") + searchCmd.Flags().String("installation", "", "Work on a non-default system-wide installation") + searchCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + searchCmd.Flags().Bool("system", false, "Work on the system-wide installation (default)") + searchCmd.Flags().BoolP("user", "u", false, "Work on the user installation") + searchCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(searchCmd) + + carapace.Gen(searchCmd).FlagCompletion(carapace.ActionMap{ + "arch": flatpak.ActionArches(), + "columns": columns(flatpak.ActionSearchColumns()), + // "installation": carapace.ActionValues(), TODO + }) + + carapace.Gen(searchCmd).PositionalCompletion( + flatpak.ActionApplicationSearch().FilterArgs(), + ) +} diff --git a/completers/flatpak_completer/cmd/uninstall.go b/completers/flatpak_completer/cmd/uninstall.go new file mode 100644 index 0000000000..83df981dd9 --- /dev/null +++ b/completers/flatpak_completer/cmd/uninstall.go @@ -0,0 +1,45 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var uninstallCmd = &cobra.Command{ + Use: "uninstall [OPTION…] [REF…]", + Short: "Uninstall applications or runtimes", + GroupID: "install", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(uninstallCmd).Standalone() + + uninstallCmd.Flags().Bool("all", false, "Uninstall all") + uninstallCmd.Flags().Bool("app", false, "Look for app with the specified name") + uninstallCmd.Flags().String("arch", "", "Arch to uninstall") + uninstallCmd.Flags().BoolP("assumeyes", "y", false, "Automatically answer yes for all questions") + uninstallCmd.Flags().Bool("delete-data", false, "Delete app data") + uninstallCmd.Flags().Bool("force-remove", false, "Remove files even if running") + uninstallCmd.Flags().BoolP("help", "h", false, "Show help options") + uninstallCmd.Flags().String("installation", "", "Work on a non-default system-wide installation") + uninstallCmd.Flags().Bool("keep-ref", false, "Keep ref in local repository") + uninstallCmd.Flags().Bool("no-related", false, "Don't uninstall related refs") + uninstallCmd.Flags().Bool("noninteractive", false, "Produce minimal output and don't ask questions") + uninstallCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + uninstallCmd.Flags().Bool("runtime", false, "Look for runtime with the specified name") + uninstallCmd.Flags().Bool("system", false, "Work on the system-wide installation (default)") + uninstallCmd.Flags().Bool("unused", false, "Uninstall unused") + uninstallCmd.Flags().BoolP("user", "u", false, "Work on the user installation") + uninstallCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(uninstallCmd) + + // TODO flags + carapace.Gen(uninstallCmd).FlagCompletion(carapace.ActionMap{ + "arch": flatpak.ActionArches(), + // "installation": carapace.ActionValues(), + }) + + // TODO positional +} diff --git a/completers/flatpak_completer/cmd/update.go b/completers/flatpak_completer/cmd/update.go new file mode 100644 index 0000000000..fbfa9d7031 --- /dev/null +++ b/completers/flatpak_completer/cmd/update.go @@ -0,0 +1,52 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/rsteube/carapace-bin/pkg/actions/tools/flatpak" + "github.com/spf13/cobra" +) + +var updateCmd = &cobra.Command{ + Use: "update [OPTION…] [REF…]", + Short: "Update applications or runtimes", + GroupID: "install", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(updateCmd).Standalone() + + updateCmd.Flags().Bool("app", false, "Look for app with the specified name") + updateCmd.Flags().Bool("appstream", false, "Update appstream for remote") + updateCmd.Flags().String("arch", "", "Arch to update for") + updateCmd.Flags().BoolP("assumeyes", "y", false, "Automatically answer yes for all questions") + updateCmd.Flags().String("commit", "", "Commit to deploy") + updateCmd.Flags().Bool("force-remove", false, "Remove old files even if running") + updateCmd.Flags().BoolP("help", "h", false, "Show help options") + updateCmd.Flags().String("installation", "", "Work on a non-default system-wide installation") + updateCmd.Flags().Bool("no-deploy", false, "Don't deploy, only download to local cache") + updateCmd.Flags().Bool("no-deps", false, "Don't verify/install runtime dependencies") + updateCmd.Flags().Bool("no-pull", false, "Don't pull, only update from local cache") + updateCmd.Flags().Bool("no-related", false, "Don't update related refs") + updateCmd.Flags().Bool("no-static-deltas", false, "Don't use static deltas") + updateCmd.Flags().Bool("noninteractive", false, "Produce minimal output and don't ask questions") + updateCmd.Flags().Bool("ostree-verbose", false, "Show OSTree debug information") + updateCmd.Flags().Bool("runtime", false, "Look for runtime with the specified name") + updateCmd.Flags().String("sideload-repo", "", "Use this local repo for sideloads") + updateCmd.Flags().String("subpath", "", "Only update this subpath") + updateCmd.Flags().Bool("system", false, "Work on the system-wide installation (default)") + updateCmd.Flags().BoolP("user", "u", false, "Work on the user installation") + updateCmd.Flags().BoolP("verbose", "v", false, "Show debug information, -vv for more detail") + rootCmd.AddCommand(updateCmd) + + // TODO flags + carapace.Gen(updateCmd).FlagCompletion(carapace.ActionMap{ + "arch": flatpak.ActionArches(), + // "commit": carapace.ActionValues(), + // "installation": carapace.ActionValues(), + // "sideload-repo": carapace.ActionValues(), + // "subpath": carapace.ActionValues(), + }) + + // TODO positional +} diff --git a/completers/flatpak_completer/main.go b/completers/flatpak_completer/main.go new file mode 100644 index 0000000000..7cb5844800 --- /dev/null +++ b/completers/flatpak_completer/main.go @@ -0,0 +1,7 @@ +package main + +import "github.com/rsteube/carapace-bin/completers/flatpak_completer/cmd" + +func main() { + cmd.Execute() +} diff --git a/docker-compose.yml b/docker-compose.yml index 27cd291670..ee16c871f9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: '3' services: build: &base - image: ghcr.io/rsteube/carapace:v0.33.4 + image: ghcr.io/rsteube/carapace command: sh -c 'sh -c "cd /carapace-bin/cmd/carapace && go generate ./... && go build -ldflags=\"-s -w\" ."' environment: TARGET: /carapace-bin/cmd/carapace/carapace diff --git a/go.mod b/go.mod index 22a23e1f78..35f7f7ea4d 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/pelletier/go-toml v1.9.5 - github.com/rsteube/carapace v0.43.3 + github.com/rsteube/carapace v0.43.4 github.com/rsteube/carapace-bridge v0.1.4 github.com/rsteube/carapace-shlex v0.0.4 github.com/rsteube/carapace-spec v0.10.5 diff --git a/go.sum b/go.sum index d9960b93e4..150f4db7ef 100644 --- a/go.sum +++ b/go.sum @@ -12,8 +12,8 @@ github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCko github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rsteube/carapace v0.40.2/go.mod h1:jkLt41Ne2TD2xPuMdX/2O05Smhy8vMgG7O2TYvC0yOc= -github.com/rsteube/carapace v0.43.3 h1:tbhTzUmpILpo1s3w+KaNWAtmeUrERAA+PT1e+6eiv2A= -github.com/rsteube/carapace v0.43.3/go.mod h1:1l4sZA+/sGW9sBLqEholUd+kn9xKgh2ghBFDYC3D/zA= +github.com/rsteube/carapace v0.43.4 h1:w9jdbpep134NgBg6usD1HGTKRDDJa9CYAgqXJfC7IdM= +github.com/rsteube/carapace v0.43.4/go.mod h1:1l4sZA+/sGW9sBLqEholUd+kn9xKgh2ghBFDYC3D/zA= github.com/rsteube/carapace-bridge v0.1.4 h1:3ZgsUlGCg5JGQTb8Kec54gn+wgVWyWej8nincgPR+gM= github.com/rsteube/carapace-bridge v0.1.4/go.mod h1:zPzdZTsLOb/adovJgEUUH+STcslqoRmvXx1vjIVOmz8= github.com/rsteube/carapace-pflag v0.2.0 h1:EYqFO9Haib3NDCPqKu0VxOGi9YQBkXk1IzlHdT0M0vw= diff --git a/pkg/actions/time/time.go b/pkg/actions/time/time.go index 51281cc320..19b4c43223 100644 --- a/pkg/actions/time/time.go +++ b/pkg/actions/time/time.go @@ -136,7 +136,7 @@ type DateTimeOpts struct { // // 2021-11-11 04:02:12 // 2021-04-02 16:11:33 -func ActionDateTime(opts DateTimeOpts) carapace.Action { +func ActionDateTime(opts DateTimeOpts) carapace.Action { // TODO might be best to just accept a pattern as in go lib here delimiter := " " if opts.Strict { delimiter = "T" diff --git a/pkg/actions/tools/flatpak/application.go b/pkg/actions/tools/flatpak/application.go new file mode 100644 index 0000000000..41a830aa27 --- /dev/null +++ b/pkg/actions/tools/flatpak/application.go @@ -0,0 +1,25 @@ +package flatpak + +import ( + "strings" + + "github.com/rsteube/carapace" +) + +// ActionApplications completes applications +// +// org.kde.Platform (Shared libraries used by KDE applications) +// org.qutebrowser.qutebrowser (A keyboard-driven web browser) +func ActionApplications() carapace.Action { + return carapace.ActionExecCommand("flatpak", "list", "--columns", "application,description")(func(output []byte) carapace.Action { + lines := strings.Split(string(output), "\n") + vals := make([]string, 0) + + for _, line := range lines { + if splitted := strings.SplitN(line, "\t", 2); len(splitted) == 2 { + vals = append(vals, splitted...) + } + } + return carapace.ActionValuesDescribed(vals...) + }) +} diff --git a/pkg/actions/tools/flatpak/arch.go b/pkg/actions/tools/flatpak/arch.go new file mode 100644 index 0000000000..2b990044c1 --- /dev/null +++ b/pkg/actions/tools/flatpak/arch.go @@ -0,0 +1,18 @@ +package flatpak + +import ( + "strings" + + "github.com/rsteube/carapace" +) + +// ActionArches completes architectures +// +// i386 +// x86_64 +func ActionArches() carapace.Action { + return carapace.ActionExecCommand("flatpak", "--supported-arches")(func(output []byte) carapace.Action { + lines := strings.Split(string(output), "\n") + return carapace.ActionValues(lines[:len(lines)-1]...) + }) +} diff --git a/pkg/actions/tools/flatpak/column.go b/pkg/actions/tools/flatpak/column.go new file mode 100644 index 0000000000..5282f92764 --- /dev/null +++ b/pkg/actions/tools/flatpak/column.go @@ -0,0 +1,169 @@ +package flatpak + +import "github.com/rsteube/carapace" + +// Complets application columns + +// name (Show the name) +// description (Show the description) +func ActionApplicationColumns() carapace.Action { + return carapace.ActionValuesDescribed( + "name", "Show the name", + "description", "Show the description", + "application", "Show the application ID", + "version", "Show the version", + "branch", "Show the branch", + "arch", "Show the architecture", + "runtime", "Show the used runtime", + "origin", "Show the origin remote", + "installation", "Show the installation", + "ref", "Show the ref", + "active", "Show the active commit", + "latest", "Show the latest commit", + "size", "Show the installed size", + "options", "Show options", + "all", "Show all columns", + "help", "Show available columns", + ) +} + +// ActionDocumentColums completes document columns + +// id (Show the document ID) +// path (Show the document path) +func ActionDocumentColums() carapace.Action { + return carapace.ActionValuesDescribed( + "id", "Show the document ID", + "path", "Show the document path", + "origin", "Show the document path", + "application", "Show applications with permission", + "permissions", "Show permissions for applications", + "all", "Show all columns", + "help", "Show available columns", + ) +} + +// ActionHistoryColums +// +// time (Show when the change happened) +// change (Show the kind of change) +func ActionHistoryColums() carapace.Action { + return carapace.ActionValuesDescribed( + "time", "Show when the change happened", + "change", "Show the kind of change", + "ref", "Show the ref", + "application", "Show the application/runtime ID", + "arch", "Show the architecture", + "branch", "Show the branch", + "installation", "Show the affected installation", + "remote", "Show the remote", + "commit", "Show the current commit", + "old-commit", "Show the previous commit", + "url", "Show the remote URL", + "user", "Show the user doing the change", + "tool", "Show the tool that was used", + "version", "Show the Flatpak version", + "all", "Show all columns", + "help", "Show available columns", + ) +} + +// ActionProcessColums completes process columns +// +// instance (Show the instance ID) +// pid (Show the PID of the wrapper process) +func ActionProcessColums() carapace.Action { + return carapace.ActionValuesDescribed( + "instance", "Show the instance ID", + "pid", "Show the PID of the wrapper process", + "child-pid", "Show the PID of the sandbox process", + "application", "Show the application ID", + "arch", "Show the architecture", + "branch", "Show the application branch", + "commit", "Show the application commit", + "runtime", "Show the runtime ID", + "runtime-branch", "Show the runtime branch", + "runtime-commit", "Show the runtime commit", + "active", "Show whether the app is active", + "background", "Show whether the app is background", + "all", "Show all columns", + "help", "Show available columns", + ) +} + +// ActionRemoteColumns completes remote columns + +// name (Show the name) +// title (Show the title) +func ActionRemoteColumns() carapace.Action { + return carapace.ActionValuesDescribed( + "name", "Show the name", + "title", "Show the title", + "url", "Show the URL", + "collection", "Show the collection ID", + "subset", "Show the subset", + "filter", "Show filter file", + "priority", "Show the priority", + "options", "Show options", + "comment", "Show comment", + "description", "Show description", + "homepage", "Show homepage", + "icon", "Show icon", + "all", "Show all columns", + "help", "Show available columns", + ) +} + +// ActionRemoteContentColumns completes remote content columns +// +// name (Show the name) +// description (Show the description) +func ActionRemoteContentColumns() carapace.Action { + return carapace.ActionValuesDescribed( + "name", "Show the name", + "description", "Show the description", + "application", "Show the application ID", + "version", "Show the version", + "branch", "Show the branch", + "arch", "Show the architecture", + "origin", "Show the origin remote", + "ref", "Show the ref", + "commit", "Show the active commit", + "runtime", "Show the runtime", + "installed-size", "Show the installed size", + "download-size", "Show the download size", + "options", "Show options", + "all", "Show all columns", + "help", "Show available columns", + ) +} + +// ActionSearchColumns completes search columns +// +// name (Show the name) +// description (Show the description) +func ActionSearchColumns() carapace.Action { + return carapace.ActionValuesDescribed( + "name", "Show the name", + "description", "Show the description", + "application", "Show the application ID", + "version", "Show the version", + "branch", "Show the application branch", + "remotes", "Show the remotes", + "all", "Show all columns", + "help", "Show available columns", + ) +} + +// ActionEllipsizations completes elipsizations +// +// s (start) +// m (middle) +func ActionEllipsizations() carapace.Action { + return carapace.ActionValuesDescribed( + "s", "start", + "m", "middle", + "e", "end", + "f", "full", + ) +} diff --git a/pkg/actions/tools/flatpak/remote.go b/pkg/actions/tools/flatpak/remote.go new file mode 100644 index 0000000000..913b5f77c9 --- /dev/null +++ b/pkg/actions/tools/flatpak/remote.go @@ -0,0 +1,22 @@ +package flatpak + +import ( + "strings" + + "github.com/rsteube/carapace" +) + +// ActionRemotes completes remotes +func ActionRemotes() carapace.Action { + return carapace.ActionExecCommand("flatpak", "remotes", "--columns", "name,description")(func(output []byte) carapace.Action { + lines := strings.Split(string(output), "\n") + vals := make([]string, 0) + + for _, line := range lines { + if splitted := strings.SplitN(line, "\t", 2); len(splitted) == 2 { + vals = append(vals, splitted...) + } + } + return carapace.ActionValuesDescribed(vals...) + }) +} diff --git a/pkg/actions/tools/flatpak/search.go b/pkg/actions/tools/flatpak/search.go new file mode 100644 index 0000000000..ab1babfddf --- /dev/null +++ b/pkg/actions/tools/flatpak/search.go @@ -0,0 +1,27 @@ +package flatpak + +import ( + "strings" + + "github.com/rsteube/carapace" +) + +// ActionApplicationSearch completes installable applications +// +// org.qutebrowser.qutebrowser (A keyboard-driven web browser) +// org.qutebrowser.qutebrowser.Userscripts (qutebrowser userscripts supporting Python modules, shared libraries, and exec...) +func ActionApplicationSearch() carapace.Action { + return carapace.ActionCallback(func(c carapace.Context) carapace.Action { + return carapace.ActionExecCommand("flatpak", "search", "--columns", "application,description", c.Value)(func(output []byte) carapace.Action { + lines := strings.Split(string(output), "\n") + vals := make([]string, 0) + + for _, line := range lines { + if splitted := strings.SplitN(line, "\t", 2); len(splitted) == 2 { + vals = append(vals, splitted...) + } + } + return carapace.ActionValuesDescribed(vals...) + }) + }) +}