mirror of
https://git.sr.ht/~phw/scotty
synced 2025-07-02 00:01: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,10 @@ import (
|
|||
)
|
||||
|
||||
var beamLovesCmd = &cobra.Command{
|
||||
Use: "loves",
|
||||
Use: "loves SOURCE TARGET",
|
||||
Short: "Transfer loves between two services",
|
||||
Long: `Transfers loves between two configured services.`,
|
||||
Args: cobra.ExactArgs(2),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
db, err := storage.New(config.DatabasePath())
|
||||
cobra.CheckErr(err)
|
||||
|
@ -36,7 +37,7 @@ var beamLovesCmd = &cobra.Command{
|
|||
models.LovesExport,
|
||||
models.LovesImport,
|
||||
models.LovesResult,
|
||||
](cmd, &db, "loves")
|
||||
](cmd, &db, "loves", args[0], args[1])
|
||||
cobra.CheckErr(err)
|
||||
exp := backends.LovesExportProcessor{Backend: c.ExpBackend}
|
||||
imp := backends.LovesImportProcessor{Backend: c.ImpBackend}
|
||||
|
@ -57,4 +58,5 @@ func init() {
|
|||
// Cobra supports local flags which will only run when this command
|
||||
// is called directly, e.g.:
|
||||
// beamLovesCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
||||
beamLovesCmd.Flags().Int64P("timestamp", "t", 0, "Only import loves newer then given Unix timestamp")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue