fix: issue with logging not initializing correctly
This commit is contained in:
parent
e5c1b59bc1
commit
3244a66f8e
2 changed files with 34 additions and 16 deletions
|
|
@ -33,7 +33,7 @@ var downloadCmd = cobra.Command{
|
|||
makeshift download -xr
|
||||
`,
|
||||
Short: "Download and modify files with plugins",
|
||||
PreRun: func(cmd *cobra.Command, args []string) {
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
setenv(cmd, "host", "MAKESHIFT_HOST")
|
||||
setenv(cmd, "path", "MAKESHIFT_PATH")
|
||||
},
|
||||
|
|
@ -158,10 +158,9 @@ var downloadProfileCmd = &cobra.Command{
|
|||
`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
Short: "Download a profile",
|
||||
PreRun: func(cmd *cobra.Command, args []string) {
|
||||
setenv(cmd, "host", "MAKESHIFT_HOST")
|
||||
setenv(cmd, "path", "MAKESHIFT_PATH")
|
||||
},
|
||||
// PreRun: func(cmd *cobra.Command, args []string) {
|
||||
// setenv(cmd, "host", "MAKESHIFT_HOST")
|
||||
// },
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
var (
|
||||
host, _ = cmd.Flags().GetString("host")
|
||||
|
|
@ -173,8 +172,14 @@ var downloadProfileCmd = &cobra.Command{
|
|||
query string
|
||||
err error
|
||||
)
|
||||
|
||||
log.Debug().
|
||||
Str("host", host).
|
||||
Str("output", outputPath).
|
||||
Send()
|
||||
|
||||
for _, profileID := range args {
|
||||
query = fmt.Sprintf("/profile/{%s}", profileID)
|
||||
query = fmt.Sprintf("/profile/%s", profileID)
|
||||
res, body, err = c.MakeRequest(client.HTTPEnvelope{
|
||||
Path: query,
|
||||
Method: http.MethodGet,
|
||||
|
|
@ -212,10 +217,9 @@ var downloadPluginCmd = &cobra.Command{
|
|||
`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
Short: "Download a plugin",
|
||||
PreRun: func(cmd *cobra.Command, args []string) {
|
||||
setenv(cmd, "host", "MAKESHIFT_HOST")
|
||||
setenv(cmd, "path", "MAKESHIFT_PATH")
|
||||
},
|
||||
// PreRun: func(cmd *cobra.Command, args []string) {
|
||||
// setenv(cmd, "host", "MAKESHIFT_HOST")
|
||||
// },
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
var (
|
||||
host, _ = cmd.Flags().GetString("host")
|
||||
|
|
@ -229,7 +233,7 @@ var downloadPluginCmd = &cobra.Command{
|
|||
)
|
||||
for _, pluginName := range args {
|
||||
|
||||
query = fmt.Sprintf("/profile/%s?", pluginName)
|
||||
query = fmt.Sprintf("/profile/%s", pluginName)
|
||||
res, body, err = c.MakeRequest(client.HTTPEnvelope{
|
||||
Path: query,
|
||||
Method: http.MethodGet,
|
||||
|
|
@ -260,9 +264,9 @@ var downloadPluginCmd = &cobra.Command{
|
|||
}
|
||||
|
||||
func init() {
|
||||
downloadCmd.Flags().String("host", "http://localhost:5050", "Set the makeshift remote host (can be set with MAKESHIFT_HOST)")
|
||||
downloadCmd.PersistentFlags().String("host", "http://localhost:5050", "Set the makeshift remote host (can be set with MAKESHIFT_HOST)")
|
||||
downloadCmd.PersistentFlags().StringP("output", "o", "", "Set the output path to write files")
|
||||
downloadCmd.Flags().StringP("path", "p", ".", "Set the path to list files (can be set with MAKESHIFT_PATH)")
|
||||
downloadCmd.Flags().StringP("output", "o", "", "Set the output path to write files")
|
||||
downloadCmd.Flags().StringSlice("profiles", []string{}, "Set the profile(s) to use to populate data store")
|
||||
downloadCmd.Flags().StringSlice("plugins", []string{}, "Set the plugin(s) to run before downloading files")
|
||||
downloadCmd.Flags().BoolP("extract", "x", false, "Set whether to extract archive locally after downloading")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue