mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-15 17:49:29 +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"
|
||||
)
|
||||
|
||||
// backendsCmd represents the backends command
|
||||
var backendsCmd = &cobra.Command{
|
||||
Use: "backends",
|
||||
Short: "List available backends",
|
||||
|
|
|
@ -20,7 +20,6 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// beamCmd represents the beam command
|
||||
var beamCmd = &cobra.Command{
|
||||
Use: "beam",
|
||||
Short: "Transfer data between two services",
|
||||
|
|
|
@ -25,8 +25,7 @@ import (
|
|||
"go.uploadedlobster.com/scotty/internal/storage"
|
||||
)
|
||||
|
||||
// listensCmd represents the listens command
|
||||
var listensCmd = &cobra.Command{
|
||||
var beamListensCmd = &cobra.Command{
|
||||
Use: "listens",
|
||||
Short: "Transfer listens between two services",
|
||||
Long: `Transfers listens between two configured services.`,
|
||||
|
@ -47,14 +46,14 @@ var listensCmd = &cobra.Command{
|
|||
}
|
||||
|
||||
func init() {
|
||||
beamCmd.AddCommand(listensCmd)
|
||||
beamCmd.AddCommand(beamListensCmd)
|
||||
// Here you will define your flags and configuration settings.
|
||||
|
||||
// Cobra supports Persistent Flags which will work for this command
|
||||
// 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
|
||||
// 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"
|
||||
)
|
||||
|
||||
// lovesCmd represents the loves command
|
||||
var lovesCmd = &cobra.Command{
|
||||
var beamLovesCmd = &cobra.Command{
|
||||
Use: "loves",
|
||||
Short: "Transfer loves between two services",
|
||||
Long: `Transfers loves between two configured services.`,
|
||||
|
@ -47,15 +46,15 @@ var lovesCmd = &cobra.Command{
|
|||
}
|
||||
|
||||
func init() {
|
||||
beamCmd.AddCommand(lovesCmd)
|
||||
beamCmd.AddCommand(beamLovesCmd)
|
||||
|
||||
// Here you will define your flags and configuration settings.
|
||||
|
||||
// Cobra supports Persistent Flags which will work for this command
|
||||
// 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
|
||||
// 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"
|
||||
)
|
||||
|
||||
// addCmd represents the add command
|
||||
var addCmd = &cobra.Command{
|
||||
var serviceAddCmd = &cobra.Command{
|
||||
Use: "add",
|
||||
Short: "Add a service configuration",
|
||||
Long: `Add a service configuration.`,
|
||||
|
@ -75,15 +74,15 @@ var addCmd = &cobra.Command{
|
|||
}
|
||||
|
||||
func init() {
|
||||
serviceCmd.AddCommand(addCmd)
|
||||
serviceCmd.AddCommand(serviceAddCmd)
|
||||
|
||||
// Here you will define your flags and configuration settings.
|
||||
|
||||
// Cobra supports Persistent Flags which will work for this command
|
||||
// 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
|
||||
// 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"
|
||||
)
|
||||
|
||||
var authCmd = &cobra.Command{
|
||||
var serviceAuthCmd = &cobra.Command{
|
||||
Use: "auth",
|
||||
Short: "Authenticate with a backend",
|
||||
Long: `For backends requiring authentication this command can be used to authenticate.`,
|
||||
|
@ -91,8 +91,8 @@ var authCmd = &cobra.Command{
|
|||
}
|
||||
|
||||
func init() {
|
||||
serviceCmd.AddCommand(authCmd)
|
||||
serviceCmd.AddCommand(serviceAuthCmd)
|
||||
|
||||
authCmd.Flags().StringP("service", "s", "", "Service configuration (required)")
|
||||
authCmd.MarkFlagRequired("service")
|
||||
serviceAuthCmd.Flags().StringP("service", "s", "", "Service configuration (required)")
|
||||
serviceAuthCmd.MarkFlagRequired("service")
|
||||
}
|
|
@ -28,8 +28,7 @@ import (
|
|||
"go.uploadedlobster.com/scotty/internal/cli"
|
||||
)
|
||||
|
||||
// deleteCmd represents the add command
|
||||
var deleteCmd = &cobra.Command{
|
||||
var serviceDeleteCmd = &cobra.Command{
|
||||
Use: "delete",
|
||||
Short: "Delete existing service configuration",
|
||||
Long: `Delete an existing service configuration.`,
|
||||
|
@ -54,15 +53,15 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
|
||||
func init() {
|
||||
serviceCmd.AddCommand(deleteCmd)
|
||||
serviceCmd.AddCommand(serviceDeleteCmd)
|
||||
|
||||
// Here you will define your flags and configuration settings.
|
||||
|
||||
// Cobra supports Persistent Flags which will work for this command
|
||||
// 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
|
||||
// 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"
|
||||
)
|
||||
|
||||
// editCmd represents the add command
|
||||
var editCmd = &cobra.Command{
|
||||
var serviceEditCmd = &cobra.Command{
|
||||
Use: "edit",
|
||||
Short: "Edit existing service configuration",
|
||||
Long: `Edit an existing service configuration.`,
|
||||
|
@ -54,15 +53,15 @@ var editCmd = &cobra.Command{
|
|||
}
|
||||
|
||||
func init() {
|
||||
serviceCmd.AddCommand(editCmd)
|
||||
serviceCmd.AddCommand(serviceEditCmd)
|
||||
|
||||
// Here you will define your flags and configuration settings.
|
||||
|
||||
// Cobra supports Persistent Flags which will work for this command
|
||||
// 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
|
||||
// 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"
|
||||
)
|
||||
|
||||
// listCmd represents the add command
|
||||
var listCmd = &cobra.Command{
|
||||
var serviceListCmd = &cobra.Command{
|
||||
Use: "list",
|
||||
Short: "List existing service configurations",
|
||||
Long: `List existing service configurations.`,
|
||||
|
@ -49,15 +48,15 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
|
||||
func init() {
|
||||
serviceCmd.AddCommand(listCmd)
|
||||
serviceCmd.AddCommand(serviceListCmd)
|
||||
|
||||
// Here you will define your flags and configuration settings.
|
||||
|
||||
// Cobra supports Persistent Flags which will work for this command
|
||||
// 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
|
||||
// is called directly, e.g.:
|
||||
listCmd.Flags().BoolP("verbose", "v", false, "Verbose output")
|
||||
serviceListCmd.Flags().BoolP("verbose", "v", false, "Verbose output")
|
||||
}
|
Loading…
Add table
Reference in a new issue