33 lines
1.0 KiB
Go
33 lines
1.0 KiB
Go
|
package cmd
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
|
||
|
"github.com/spf13/cobra"
|
||
|
)
|
||
|
|
||
|
// uploadCmd represents the upload command
|
||
|
var uploadCmd = &cobra.Command{
|
||
|
Use: "upload",
|
||
|
Short: "Upload local Calibre library to the MotW server.",
|
||
|
Long: `Upload local Calibre library to the Memory of the World server.
|
||
|
It will take care of the differences so files already at the server
|
||
|
will not be uploaded again.
|
||
|
|
||
|
Every time the directory path and/or librarian is provided it is saved in
|
||
|
configuration file for the future use (therefore: 'accorder upload PROFILE'
|
||
|
should be enough for the next successful upload).`,
|
||
|
Args: OnlyProfileArgument,
|
||
|
Run: func(cmd *cobra.Command, args []string) {
|
||
|
fmt.Println(args)
|
||
|
},
|
||
|
}
|
||
|
|
||
|
func init() {
|
||
|
rootCmd.AddCommand(uploadCmd)
|
||
|
uploadCmd.PersistentFlags().StringP("directory", "d", "", "A local Calibre directory path.")
|
||
|
uploadCmd.PersistentFlags().StringP("librarian", "l", "", "Librarian's name.")
|
||
|
uploadCmd.PersistentFlags().BoolP("delete-residue", "", false, "Delete any remote files not present locally anymore.")
|
||
|
CustomHelpOutput(uploadCmd)
|
||
|
}
|