mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-25 13:57:56 +02:00
Use positional arguments for source and target in beam commands
This commit is contained in:
parent
3ab0ce1cc6
commit
20f1732858
4 changed files with 20 additions and 22 deletions
|
@ -26,9 +26,11 @@ import (
|
|||
)
|
||||
|
||||
var beamListensCmd = &cobra.Command{
|
||||
Use: "listens",
|
||||
Short: "Transfer listens between two services",
|
||||
Long: `Transfers listens between two configured services.`,
|
||||
Use: "listens SOURCE TARGET",
|
||||
Short: "Transfer listens between two services",
|
||||
Long: `Transfers listens between two configured services.`,
|
||||
Args: cobra.ExactArgs(2),
|
||||
ArgAliases: []string{"source", "target"},
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
db, err := storage.New(config.DatabasePath())
|
||||
cobra.CheckErr(err)
|
||||
|
@ -36,7 +38,7 @@ var beamListensCmd = &cobra.Command{
|
|||
models.ListensExport,
|
||||
models.ListensImport,
|
||||
models.ListensResult,
|
||||
](cmd, &db, "listens")
|
||||
](cmd, &db, "listens", args[0], args[1])
|
||||
cobra.CheckErr(err)
|
||||
exp := backends.ListensExportProcessor{Backend: c.ExpBackend}
|
||||
imp := backends.ListensImportProcessor{Backend: c.ImpBackend}
|
||||
|
@ -56,4 +58,5 @@ func init() {
|
|||
// Cobra supports local flags which will only run when this command
|
||||
// is called directly, e.g.:
|
||||
// beamListensCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
||||
beamListensCmd.Flags().Int64P("timestamp", "t", 0, "Only import listens newer then given Unix timestamp")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue