-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #140 from hibare/dev
Use GoCommon
- Loading branch information
Showing
17 changed files
with
100 additions
and
367 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
package clean | ||
package config | ||
|
||
import ( | ||
log "github.com/sirupsen/logrus" | ||
|
||
"github.com/hibare/GoS3Backup/internal/config" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var CleanCmd = &cobra.Command{ | ||
var CleanConfigCmd = &cobra.Command{ | ||
Use: "clean", | ||
Short: "Command to clean up program config", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
config.CleanConfig() | ||
if err := config.CleanConfig(); err != nil { | ||
log.Fatalf("Error: %v", err) | ||
} | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package config | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var ConfigCmd = &cobra.Command{ | ||
Use: "config", | ||
Short: "Manage Application Config", | ||
} | ||
|
||
func init() { | ||
ConfigCmd.AddCommand(InitConfigCmd) | ||
ConfigCmd.AddCommand(CleanConfigCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package config | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/hibare/GoS3Backup/internal/config" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var InitConfigCmd = &cobra.Command{ | ||
Use: "init", | ||
Short: "Initialize application config", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
if err := config.InitConfig(); err != nil { | ||
fmt.Println(err) | ||
} else { | ||
fmt.Printf("\n\nConfig file path: %s\n", config.BC.ConfigFilePath) | ||
fmt.Printf("Empty config file is loaded at above location. Edit config as per your needs.\n\n") | ||
} | ||
}, | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.