-
Notifications
You must be signed in to change notification settings - Fork 14
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 #8 from marwanhawari/xdg_spec_4
Allow user configuration and support XDG spec by default
- Loading branch information
Showing
16 changed files
with
517 additions
and
191 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
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,37 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/marwanhawari/stew/constants" | ||
stew "github.com/marwanhawari/stew/lib" | ||
) | ||
|
||
func Config() { | ||
|
||
userOS, _, stewConfig, _, err := stew.Initialize() | ||
if err != nil { | ||
fmt.Println(err) | ||
os.Exit(1) | ||
} | ||
|
||
stewConfigFilePath, err := stew.GetStewConfigFilePath(userOS) | ||
stew.CatchAndExit(err) | ||
|
||
inputStewPath, err := stew.PromptInput("Set the stewPath. This will contain all stew data other than the binaries.", stewConfig.StewPath) | ||
stew.CatchAndExit(err) | ||
inputStewBinPath, err := stew.PromptInput("Set the stewBinPath. This is where the binaries will be installed by stew.", stewConfig.StewBinPath) | ||
stew.CatchAndExit(err) | ||
|
||
fullStewPath, err := stew.ResolveTilde(inputStewPath) | ||
stew.CatchAndExit(err) | ||
fullStewBinPath, err := stew.ResolveTilde(inputStewBinPath) | ||
stew.CatchAndExit(err) | ||
|
||
newStewConfig := stew.StewConfig{StewPath: fullStewPath, StewBinPath: fullStewBinPath} | ||
err = stew.WriteStewConfigJSON(newStewConfig, stewConfigFilePath) | ||
stew.CatchAndExit(err) | ||
|
||
fmt.Printf("📄 Updated %v\n", constants.GreenColor(stewConfigFilePath)) | ||
} |
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.