Initial Commit
This commit is contained in:
36
cmd/get.go
Normal file
36
cmd/get.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// getCmd represents the get command
|
||||
var getCmd = &cobra.Command{
|
||||
Use: "get",
|
||||
Short: "A brief description of your command",
|
||||
Long: `A longer description that spans multiple lines and likely contains examples
|
||||
and usage of using your command. For example:
|
||||
|
||||
Cobra is a CLI library for Go that empowers applications.
|
||||
This application is a tool to generate the needed files
|
||||
to quickly create a Cobra application.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println("get called")
|
||||
},
|
||||
}
|
||||
|
||||
var (
|
||||
url string
|
||||
downloadLocation string
|
||||
)
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(getCmd)
|
||||
|
||||
getCmd.Flags().StringVarP(&url, "url", "u", "", "Bunkrr album url (required)")
|
||||
getCmd.Flags().StringVarP(&downloadLocation, "location", "l", "./", "Download destination, it will create a folder inside of it with the album id")
|
||||
getCmd.MarkFlagRequired("url")
|
||||
|
||||
}
|
||||
29
cmd/info.go
Normal file
29
cmd/info.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// infoCmd represents the info command
|
||||
var infoCmd = &cobra.Command{
|
||||
Use: "info",
|
||||
Short: "A simple info fetch of a bunkr album",
|
||||
Long: `The command is used to fetch information about a specific bunkrr album, it will reply with all the information it has about it.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println("info called")
|
||||
},
|
||||
}
|
||||
|
||||
var (
|
||||
albumURL string
|
||||
)
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(infoCmd)
|
||||
|
||||
infoCmd.Flags().StringVarP(&albumURL, "url", "u", "", "Bunkrr album url (required)")
|
||||
infoCmd.MarkFlagRequired("url")
|
||||
|
||||
}
|
||||
27
cmd/root.go
Normal file
27
cmd/root.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// rootCmd represents the base command when called without any subcommands
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "grabrr",
|
||||
Short: "A tool for downloading bunkrr content",
|
||||
Long: `A tool used for downloading albums from bunkrr, be it files, photos or videos.`,
|
||||
}
|
||||
|
||||
// Execute adds all child commands to the root command and sets flags appropriately.
|
||||
// This is called by main.main(). It only needs to happen once to the rootCmd.
|
||||
func Execute() {
|
||||
err := rootCmd.Execute()
|
||||
if err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
// rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
||||
}
|
||||
Reference in New Issue
Block a user