Skip to content

Commit 9877bd2

Browse files
authored
fix: fix permissions (#133)
* fix: fix permissions * print help --------- Co-authored-by: [email protected] <[email protected]>
1 parent 705d994 commit 9877bd2

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

src/cmd/root.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ func rootCmd() *cmdBuilder.Cmd {
4343

4444
cmdData.UxBlocks.Table(body)
4545

46+
// print the default command help
47+
cmdData.PrintHelp()
48+
4649
return nil
4750
}).
4851
LoggedUserRunFunc(func(ctx context.Context, cmdData *cmdBuilder.LoggedUserCmdData) error {
@@ -92,6 +95,9 @@ func rootCmd() *cmdBuilder.Cmd {
9295

9396
cmdData.UxBlocks.Table(body)
9497

98+
// print the default command help
99+
cmdData.PrintHelp()
100+
95101
return nil
96102
})
97103
}

src/cmdBuilder/createRunFunc.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ type GuestCmdData struct {
5050
UxBlocks uxBlock.UxBlocks
5151
Args map[string][]string
5252
Params ParamsReader
53+
54+
PrintHelp func()
5355
}
5456

5557
type LoggedUserCmdData struct {
@@ -86,6 +88,10 @@ func createCmdRunFunc(
8688
UxBlocks: uxBlocks,
8789
Args: argsMap,
8890
Params: newCmdParamReader(cobraCmd, flagParams),
91+
92+
PrintHelp: func() {
93+
cobraCmd.HelpFunc()(cobraCmd, []string{})
94+
},
8995
}
9096

9197
storedData := cliStorage.Data()

src/constants/zerops.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func checkPath(filePath string) (string, error) {
9595
return "", err
9696
}
9797

98-
f, err := os.OpenFile(filePath, os.O_RDONLY|os.O_CREATE, 0666)
98+
f, err := os.OpenFile(filePath, os.O_APPEND|os.O_CREATE|os.O_RDWR, 0666)
9999
if err != nil {
100100
return "", err
101101
}

src/logger/hooks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func (hook *VarLogHook) Fire(entry *logrus.Entry) error {
3131
return err
3232
}
3333

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

0 commit comments

Comments
 (0)