-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.go
77 lines (72 loc) · 2.5 KB
/
init.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package cmd
import (
"github.com/spf13/cobra"
// "github.com/vulppine/fotoDen/generator"
"github.com/vulppine/fotoDen/tool"
)
func init() {
rootCmd.AddCommand(initCmd)
// initCmd.AddCommand(initConfigCmd)
// initConfigCmd.Flags().StringVar(&tool.URLFlag, "url", "", "what URL to initialize fotoDen with")
initCmd.AddCommand(initSiteCmd)
initSiteCmd.Flags().StringVar(&tool.URLFlag, "source", "", "where fotoDen should obtain its images")
initSiteCmd.Flags().StringVar(&websiteInit.URL, "url", "", "what URL to initialize fotoDen with")
initSiteCmd.Flags().StringVar(&websiteInit.Name, "name", "", "what name a site should have (with init site)")
initSiteCmd.Flags().StringVar(&websiteInit.Theme, "theme", "", "what theme a site should use")
// initCmd.AddCommand(initThemeCmd)
// initThemeCmd.Flags().StringVar(&tool.URLFlag, "url", "", "what URL to initialize fotoDen with")
// initCmd.AddCommand(initJSCmd)
}
var (
initCmd = &cobra.Command{
Use: "init { site | theme } destination",
Short: "Initializes various fotoDen resources",
Long: `Initializes fotoDen resources. Takes two args: What to initialize, and where to put it, in that order.`,
}
/* Deprecated, see init.go in tool root
initConfigCmd = &cobra.Command{
Use: "config [--url url] directory",
Short: "Initializes a fotoDen configuration directory with the given name",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
err := tool.InitializefotoDenConfig(tool.URLFlag, args[0])
return err
},
}
*/
websiteInit tool.WebsiteConfig
initSiteCmd = &cobra.Command{
Use: "site [--name] destination",
Short: "Initializes a fotoDen website in the given directory",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
err := tool.InitializefotoDenRoot(args[0], websiteInit)
return err
},
}
/* Deprecated in favor of zipped/embed theme files
initThemeCmd = &cobra.Command{
Use: "theme source",
Short: "Initalizes a fotoDen theme into the configuration directory",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
err := tool.CopyThemeToConfig(args[0])
return err
},
}
*/
/*
initJSCmd = &cobra.Command{
Use: "js source",
Short: "Checks and copies over a fotoDen.js file into the configuration directory",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
err := tool.InitializefotoDenjs(args[0])
if err != nil {
return err
}
return nil
},
}
*/
)