shiori/internal/cmd/root.go

57 lines
892 B
Go
Raw Normal View History

2019-05-21 11:31:40 +08:00
package cmd
import (
2019-06-09 15:54:07 +08:00
"crypto/tls"
2019-05-22 00:24:11 +08:00
"net/http"
2019-06-09 15:54:07 +08:00
"net/http/cookiejar"
2019-05-22 00:24:11 +08:00
"time"
"github.com/go-shiori/shiori/internal/database"
2019-05-21 11:31:40 +08:00
"github.com/spf13/cobra"
)
2019-05-22 00:24:11 +08:00
var (
// DB is database that used by cmd
DB database.DB
// DataDir is directory for downloaded data
DataDir string
2019-06-09 15:54:07 +08:00
httpClient *http.Client
2019-05-22 00:24:11 +08:00
)
2019-06-09 15:54:07 +08:00
func init() {
jar, _ := cookiejar.New(nil)
httpClient = &http.Client{
Timeout: time.Minute,
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
},
Jar: jar,
}
}
2019-05-21 11:31:40 +08:00
// ShioriCmd returns the root command for shiori
func ShioriCmd() *cobra.Command {
rootCmd := &cobra.Command{
Use: "shiori",
Short: "Simple command-line bookmark manager built with Go",
}
rootCmd.AddCommand(
addCmd(),
printCmd(),
updateCmd(),
deleteCmd(),
openCmd(),
importCmd(),
exportCmd(),
pocketCmd(),
serveCmd(),
)
return rootCmd
}