File tree Expand file tree Collapse file tree 4 files changed +9
-9
lines changed
Expand file tree Collapse file tree 4 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ func (a App) Command() *cobra.Command {
2323 }
2424 cmd .SetOut (os .Stdout )
2525 cmd .SetErr (os .Stderr )
26+ cmd .PersistentPreRun = func (cmd * cobra.Command , args []string ) {
27+ cmd .SilenceUsage = true
28+ }
2629 opts := & cli.Options {}
2730 subs := []subcommand {
2831 sync {opts },
Original file line number Diff line number Diff line change @@ -15,10 +15,10 @@ type sync struct {
1515
1616func (s sync ) command () * cobra.Command {
1717 cmd := & cobra.Command {
18- Use : "sync" ,
18+ Use : "sync [project-dir] " ,
1919 Short : "Synchronize to the upstream releases" ,
2020 ValidArgs : []string {"REPOSITORY" },
21- Args : cobra .OnlyValidArgs ,
21+ Args : cobra .MaximumNArgs ( 1 ) ,
2222 RunE : s .run ,
2323 }
2424 return cmd
@@ -35,16 +35,16 @@ func (s sync) project(args []string) func() config.Project {
3535 if err != nil {
3636 wd = "/"
3737 }
38+ if len (args ) > 0 {
39+ wd = args [0 ]
40+ }
3841 if ! path .IsAbs (configPath ) {
3942 configPath = path .Join (wd , configPath )
4043 }
4144 project := config.Project {
4245 ConfigPath : configPath ,
4346 Path : wd ,
4447 }
45- if len (args ) > 0 {
46- project .Path = args [0 ]
47- }
4848 return project
4949 }
5050}
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ func (c createPR) open() error {
101101 cl := github .NewClient (args ... )
102102 cl .ProjectDir = c .Path
103103 buff , err := cl .Execute (c .Context )
104- defer c .Println ("Github client:" , buff )
104+ defer c .Println ("Github client:" , string ( buff ) )
105105 return errors .Wrap (err , ErrSyncFailed )
106106}
107107
Original file line number Diff line number Diff line change @@ -81,9 +81,6 @@ func (r resyncRelease) run() error {
8181 r .generateImages (r .rel ),
8282 r .commitChanges (r .ImagesGenerated , changesDetected ),
8383 func () (err error ) {
84- defer func () {
85- err = errors .Join (err , r .deleteBranch (syncBranch ))
86- }()
8784 if ! changes {
8885 return nil
8986 }
You can’t perform that action at this time.
0 commit comments