Skip to content

Commit

Permalink
Fix some arguments handlings
Browse files Browse the repository at this point in the history
I with this is not the cause of #442
  • Loading branch information
kachick committed Mar 7, 2024
1 parent f8f5d07 commit d358607
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 4 additions & 5 deletions cmd/winit-conf/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,13 @@ func (p provisioner) Copy() error {
func main() {
pwshProfilePathFlag := flag.String("pwsh_profile_path", "", "Specify PowerShell profile path")
flag.Parse()
// $PROFILE is an "Automatic Variables", not ENV
// https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_automatic_variables?view=powershell-7.4
pwshProfilePath := filepath.Clean(*pwshProfilePathFlag)

if pwshProfilePath == "" {
if *pwshProfilePathFlag == "" {
flag.Usage()
log.Fatalf("called with wrong arguments")
}
// $PROFILE is an "Automatic Variables", not ENV
// https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_automatic_variables?view=powershell-7.4
pwshProfilePath := filepath.Clean(*pwshProfilePathFlag)

for _, p := range provisioners(pwshProfilePath) {
log.Printf("%s => %s\n", p.EmbedPath(), p.DstPath())
Expand Down
7 changes: 7 additions & 0 deletions cmd/winit-reg/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ func main() {
runCmd := flag.NewFlagSet("run", flag.ExitOnError)
actionFlag := runCmd.String("action", "", "which action you want to do")
allFlag := runCmd.Bool("all", false, "do ALL if you trust me")
flag.Parse()

if len(os.Args) < 1 {
flag.Usage()

os.Exit(1)
}

switch os.Args[1] {
case "list":
Expand Down

0 comments on commit d358607

Please sign in to comment.