|
|
|
@ -15,7 +15,6 @@ func init() {
|
|
|
|
linkCommand.AddCommand(listCommand)
|
|
|
|
linkCommand.AddCommand(listCommand)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var linkCommand = &cobra.Command{
|
|
|
|
var linkCommand = &cobra.Command{
|
|
|
|
Use: "link",
|
|
|
|
Use: "link",
|
|
|
|
Run: runLinkCommand,
|
|
|
|
Run: runLinkCommand,
|
|
|
|
@ -23,7 +22,6 @@ var linkCommand = &cobra.Command {
|
|
|
|
Long: "add longer description", // TODO add longer description here
|
|
|
|
Long: "add longer description", // TODO add longer description here
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func runLinkCommand(cmd *cobra.Command, args []string) {
|
|
|
|
func runLinkCommand(cmd *cobra.Command, args []string) {
|
|
|
|
fs := FileSystem
|
|
|
|
fs := FileSystem
|
|
|
|
fmt.Println("Symlinking dotfiles...")
|
|
|
|
fmt.Println("Symlinking dotfiles...")
|
|
|
|
@ -41,9 +39,8 @@ func runLinkCommand(cmd *cobra.Command, args []string) {
|
|
|
|
fmt.Fprintf(cmd.OutOrStdout(), "Warning: could not find config for %s\n", configName)
|
|
|
|
fmt.Fprintf(cmd.OutOrStdout(), "Warning: could not find config for %s\n", configName)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// destination needs to be removed before symlink
|
|
|
|
// destination needs to be removed before symlink
|
|
|
|
if(DryRun) {
|
|
|
|
if DryRun {
|
|
|
|
log.Printf("Existing directory %s will be removed\n", configPath)
|
|
|
|
log.Printf("Existing directory %s will be removed\n", configPath)
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -52,10 +49,10 @@ func runLinkCommand(cmd *cobra.Command, args []string) {
|
|
|
|
|
|
|
|
|
|
|
|
testing := viper.Get("testing")
|
|
|
|
testing := viper.Get("testing")
|
|
|
|
|
|
|
|
|
|
|
|
if(DryRun) {
|
|
|
|
if DryRun {
|
|
|
|
log.Printf("Will link %s -> %s\n", configPath, dotPath)
|
|
|
|
log.Printf("Will link %s -> %s\n", configPath, dotPath)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if(testing == true) {
|
|
|
|
if testing == true {
|
|
|
|
fmt.Fprintf(cmd.OutOrStdout(), "%s,%s", configPath, dotPath)
|
|
|
|
fmt.Fprintf(cmd.OutOrStdout(), "%s,%s", configPath, dotPath)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
err := afero.OsFs.SymlinkIfPossible(afero.OsFs{}, dotPath, configPath)
|
|
|
|
err := afero.OsFs.SymlinkIfPossible(afero.OsFs{}, dotPath, configPath)
|
|
|
|
@ -69,7 +66,6 @@ func runLinkCommand(cmd *cobra.Command, args []string) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var listCommand = &cobra.Command{
|
|
|
|
var listCommand = &cobra.Command{
|
|
|
|
Use: "list",
|
|
|
|
Use: "list",
|
|
|
|
Run: runListCommand,
|
|
|
|
Run: runListCommand,
|
|
|
|
|