mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-25 13:57:56 +02:00
Restructured cmd files
This commit is contained in:
parent
543a9c666d
commit
3ab0ce1cc6
9 changed files with 28 additions and 36 deletions
|
@ -24,7 +24,6 @@ import (
|
||||||
"go.uploadedlobster.com/scotty/internal/backends"
|
"go.uploadedlobster.com/scotty/internal/backends"
|
||||||
)
|
)
|
||||||
|
|
||||||
// backendsCmd represents the backends command
|
|
||||||
var backendsCmd = &cobra.Command{
|
var backendsCmd = &cobra.Command{
|
||||||
Use: "backends",
|
Use: "backends",
|
||||||
Short: "List available backends",
|
Short: "List available backends",
|
||||||
|
|
|
@ -20,7 +20,6 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// beamCmd represents the beam command
|
|
||||||
var beamCmd = &cobra.Command{
|
var beamCmd = &cobra.Command{
|
||||||
Use: "beam",
|
Use: "beam",
|
||||||
Short: "Transfer data between two services",
|
Short: "Transfer data between two services",
|
||||||
|
|
|
@ -25,8 +25,7 @@ import (
|
||||||
"go.uploadedlobster.com/scotty/internal/storage"
|
"go.uploadedlobster.com/scotty/internal/storage"
|
||||||
)
|
)
|
||||||
|
|
||||||
// listensCmd represents the listens command
|
var beamListensCmd = &cobra.Command{
|
||||||
var listensCmd = &cobra.Command{
|
|
||||||
Use: "listens",
|
Use: "listens",
|
||||||
Short: "Transfer listens between two services",
|
Short: "Transfer listens between two services",
|
||||||
Long: `Transfers listens between two configured services.`,
|
Long: `Transfers listens between two configured services.`,
|
||||||
|
@ -47,14 +46,14 @@ var listensCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
beamCmd.AddCommand(listensCmd)
|
beamCmd.AddCommand(beamListensCmd)
|
||||||
// Here you will define your flags and configuration settings.
|
// Here you will define your flags and configuration settings.
|
||||||
|
|
||||||
// Cobra supports Persistent Flags which will work for this command
|
// Cobra supports Persistent Flags which will work for this command
|
||||||
// and all subcommands, e.g.:
|
// and all subcommands, e.g.:
|
||||||
// listensCmd.PersistentFlags().String("foo", "", "A help for foo")
|
// beamListensCmd.PersistentFlags().String("foo", "", "A help for foo")
|
||||||
|
|
||||||
// Cobra supports local flags which will only run when this command
|
// Cobra supports local flags which will only run when this command
|
||||||
// is called directly, e.g.:
|
// is called directly, e.g.:
|
||||||
// listensCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
// beamListensCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
||||||
}
|
}
|
|
@ -25,8 +25,7 @@ import (
|
||||||
"go.uploadedlobster.com/scotty/internal/storage"
|
"go.uploadedlobster.com/scotty/internal/storage"
|
||||||
)
|
)
|
||||||
|
|
||||||
// lovesCmd represents the loves command
|
var beamLovesCmd = &cobra.Command{
|
||||||
var lovesCmd = &cobra.Command{
|
|
||||||
Use: "loves",
|
Use: "loves",
|
||||||
Short: "Transfer loves between two services",
|
Short: "Transfer loves between two services",
|
||||||
Long: `Transfers loves between two configured services.`,
|
Long: `Transfers loves between two configured services.`,
|
||||||
|
@ -47,15 +46,15 @@ var lovesCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
beamCmd.AddCommand(lovesCmd)
|
beamCmd.AddCommand(beamLovesCmd)
|
||||||
|
|
||||||
// Here you will define your flags and configuration settings.
|
// Here you will define your flags and configuration settings.
|
||||||
|
|
||||||
// Cobra supports Persistent Flags which will work for this command
|
// Cobra supports Persistent Flags which will work for this command
|
||||||
// and all subcommands, e.g.:
|
// and all subcommands, e.g.:
|
||||||
// lovesCmd.PersistentFlags().String("foo", "", "A help for foo")
|
// beamLovesCmd.PersistentFlags().String("foo", "", "A help for foo")
|
||||||
|
|
||||||
// Cobra supports local flags which will only run when this command
|
// Cobra supports local flags which will only run when this command
|
||||||
// is called directly, e.g.:
|
// is called directly, e.g.:
|
||||||
// lovesCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
// beamLovesCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
||||||
}
|
}
|
|
@ -31,8 +31,7 @@ import (
|
||||||
"go.uploadedlobster.com/scotty/internal/config"
|
"go.uploadedlobster.com/scotty/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// addCmd represents the add command
|
var serviceAddCmd = &cobra.Command{
|
||||||
var addCmd = &cobra.Command{
|
|
||||||
Use: "add",
|
Use: "add",
|
||||||
Short: "Add a service configuration",
|
Short: "Add a service configuration",
|
||||||
Long: `Add a service configuration.`,
|
Long: `Add a service configuration.`,
|
||||||
|
@ -75,15 +74,15 @@ var addCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
serviceCmd.AddCommand(addCmd)
|
serviceCmd.AddCommand(serviceAddCmd)
|
||||||
|
|
||||||
// Here you will define your flags and configuration settings.
|
// Here you will define your flags and configuration settings.
|
||||||
|
|
||||||
// Cobra supports Persistent Flags which will work for this command
|
// Cobra supports Persistent Flags which will work for this command
|
||||||
// and all subcommands, e.g.:
|
// and all subcommands, e.g.:
|
||||||
// addCmd.PersistentFlags().String("foo", "", "A help for foo")
|
// serviceAddCmd.PersistentFlags().String("foo", "", "A help for foo")
|
||||||
|
|
||||||
// Cobra supports local flags which will only run when this command
|
// Cobra supports local flags which will only run when this command
|
||||||
// is called directly, e.g.:
|
// is called directly, e.g.:
|
||||||
// addCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
// serviceAddCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
||||||
}
|
}
|
|
@ -33,7 +33,7 @@ import (
|
||||||
"golang.org/x/oauth2"
|
"golang.org/x/oauth2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var authCmd = &cobra.Command{
|
var serviceAuthCmd = &cobra.Command{
|
||||||
Use: "auth",
|
Use: "auth",
|
||||||
Short: "Authenticate with a backend",
|
Short: "Authenticate with a backend",
|
||||||
Long: `For backends requiring authentication this command can be used to authenticate.`,
|
Long: `For backends requiring authentication this command can be used to authenticate.`,
|
||||||
|
@ -91,8 +91,8 @@ var authCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
serviceCmd.AddCommand(authCmd)
|
serviceCmd.AddCommand(serviceAuthCmd)
|
||||||
|
|
||||||
authCmd.Flags().StringP("service", "s", "", "Service configuration (required)")
|
serviceAuthCmd.Flags().StringP("service", "s", "", "Service configuration (required)")
|
||||||
authCmd.MarkFlagRequired("service")
|
serviceAuthCmd.MarkFlagRequired("service")
|
||||||
}
|
}
|
|
@ -28,8 +28,7 @@ import (
|
||||||
"go.uploadedlobster.com/scotty/internal/cli"
|
"go.uploadedlobster.com/scotty/internal/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
// deleteCmd represents the add command
|
var serviceDeleteCmd = &cobra.Command{
|
||||||
var deleteCmd = &cobra.Command{
|
|
||||||
Use: "delete",
|
Use: "delete",
|
||||||
Short: "Delete existing service configuration",
|
Short: "Delete existing service configuration",
|
||||||
Long: `Delete an existing service configuration.`,
|
Long: `Delete an existing service configuration.`,
|
||||||
|
@ -54,15 +53,15 @@ var deleteCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
serviceCmd.AddCommand(deleteCmd)
|
serviceCmd.AddCommand(serviceDeleteCmd)
|
||||||
|
|
||||||
// Here you will define your flags and configuration settings.
|
// Here you will define your flags and configuration settings.
|
||||||
|
|
||||||
// Cobra supports Persistent Flags which will work for this command
|
// Cobra supports Persistent Flags which will work for this command
|
||||||
// and all subcommands, e.g.:
|
// and all subcommands, e.g.:
|
||||||
// deleteCmd.PersistentFlags().String("foo", "", "A help for foo")
|
// serviceDeleteCmd.PersistentFlags().String("foo", "", "A help for foo")
|
||||||
|
|
||||||
// Cobra supports local flags which will only run when this command
|
// Cobra supports local flags which will only run when this command
|
||||||
// is called directly, e.g.:
|
// is called directly, e.g.:
|
||||||
// deleteCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
// serviceDeleteCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
||||||
}
|
}
|
|
@ -28,8 +28,7 @@ import (
|
||||||
"go.uploadedlobster.com/scotty/internal/cli"
|
"go.uploadedlobster.com/scotty/internal/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
// editCmd represents the add command
|
var serviceEditCmd = &cobra.Command{
|
||||||
var editCmd = &cobra.Command{
|
|
||||||
Use: "edit",
|
Use: "edit",
|
||||||
Short: "Edit existing service configuration",
|
Short: "Edit existing service configuration",
|
||||||
Long: `Edit an existing service configuration.`,
|
Long: `Edit an existing service configuration.`,
|
||||||
|
@ -54,15 +53,15 @@ var editCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
serviceCmd.AddCommand(editCmd)
|
serviceCmd.AddCommand(serviceEditCmd)
|
||||||
|
|
||||||
// Here you will define your flags and configuration settings.
|
// Here you will define your flags and configuration settings.
|
||||||
|
|
||||||
// Cobra supports Persistent Flags which will work for this command
|
// Cobra supports Persistent Flags which will work for this command
|
||||||
// and all subcommands, e.g.:
|
// and all subcommands, e.g.:
|
||||||
// editCmd.PersistentFlags().String("foo", "", "A help for foo")
|
// serviceEditCmd.PersistentFlags().String("foo", "", "A help for foo")
|
||||||
|
|
||||||
// Cobra supports local flags which will only run when this command
|
// Cobra supports local flags which will only run when this command
|
||||||
// is called directly, e.g.:
|
// is called directly, e.g.:
|
||||||
// editCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
// serviceEditCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
||||||
}
|
}
|
|
@ -28,8 +28,7 @@ import (
|
||||||
"go.uploadedlobster.com/scotty/internal/config"
|
"go.uploadedlobster.com/scotty/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// listCmd represents the add command
|
var serviceListCmd = &cobra.Command{
|
||||||
var listCmd = &cobra.Command{
|
|
||||||
Use: "list",
|
Use: "list",
|
||||||
Short: "List existing service configurations",
|
Short: "List existing service configurations",
|
||||||
Long: `List existing service configurations.`,
|
Long: `List existing service configurations.`,
|
||||||
|
@ -49,15 +48,15 @@ var listCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
serviceCmd.AddCommand(listCmd)
|
serviceCmd.AddCommand(serviceListCmd)
|
||||||
|
|
||||||
// Here you will define your flags and configuration settings.
|
// Here you will define your flags and configuration settings.
|
||||||
|
|
||||||
// Cobra supports Persistent Flags which will work for this command
|
// Cobra supports Persistent Flags which will work for this command
|
||||||
// and all subcommands, e.g.:
|
// and all subcommands, e.g.:
|
||||||
// listCmd.PersistentFlags().String("foo", "", "A help for foo")
|
// serviceListCmd.PersistentFlags().String("foo", "", "A help for foo")
|
||||||
|
|
||||||
// Cobra supports local flags which will only run when this command
|
// Cobra supports local flags which will only run when this command
|
||||||
// is called directly, e.g.:
|
// is called directly, e.g.:
|
||||||
listCmd.Flags().BoolP("verbose", "v", false, "Verbose output")
|
serviceListCmd.Flags().BoolP("verbose", "v", false, "Verbose output")
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue