Skip to content

Commit

Permalink
fix: fix permissions (#133)
Browse files Browse the repository at this point in the history
* fix: fix permissions

* print help

---------

Co-authored-by: [email protected] <[email protected]>
  • Loading branch information
jan-hajek and jan-hajek authored Mar 16, 2024
1 parent 705d994 commit 9877bd2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ func rootCmd() *cmdBuilder.Cmd {

cmdData.UxBlocks.Table(body)

// print the default command help
cmdData.PrintHelp()

return nil
}).
LoggedUserRunFunc(func(ctx context.Context, cmdData *cmdBuilder.LoggedUserCmdData) error {
Expand Down Expand Up @@ -92,6 +95,9 @@ func rootCmd() *cmdBuilder.Cmd {

cmdData.UxBlocks.Table(body)

// print the default command help
cmdData.PrintHelp()

return nil
})
}
Expand Down
6 changes: 6 additions & 0 deletions src/cmdBuilder/createRunFunc.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ type GuestCmdData struct {
UxBlocks uxBlock.UxBlocks
Args map[string][]string
Params ParamsReader

PrintHelp func()
}

type LoggedUserCmdData struct {
Expand Down Expand Up @@ -86,6 +88,10 @@ func createCmdRunFunc(
UxBlocks: uxBlocks,
Args: argsMap,
Params: newCmdParamReader(cobraCmd, flagParams),

PrintHelp: func() {
cobraCmd.HelpFunc()(cobraCmd, []string{})
},
}

storedData := cliStorage.Data()
Expand Down
2 changes: 1 addition & 1 deletion src/constants/zerops.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func checkPath(filePath string) (string, error) {
return "", err
}

f, err := os.OpenFile(filePath, os.O_RDONLY|os.O_CREATE, 0666)
f, err := os.OpenFile(filePath, os.O_APPEND|os.O_CREATE|os.O_RDWR, 0666)
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion src/logger/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (hook *VarLogHook) Fire(entry *logrus.Entry) error {
return err
}

f, err := os.OpenFile(hook.path, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0775)
f, err := os.OpenFile(hook.path, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0666)
if err != nil {
fmt.Fprintf(os.Stderr, "Unable to open file, %v", err)
return err
Expand Down

0 comments on commit 9877bd2

Please sign in to comment.