File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -120,7 +120,11 @@ func pushApp() *cli.App {
120120 if c .NArg () != 0 {
121121 return cli .ShowAppHelp (c )
122122 }
123- return push ()
123+
124+ m := newResultModel ()
125+ m .message , m .err = push ()
126+
127+ return tea .NewProgram (& m ).Start ()
124128 },
125129 }
126130}
Original file line number Diff line number Diff line change @@ -43,22 +43,27 @@ func currentBranch() (string, error) {
4343 var buf bytes.Buffer
4444 err := gitCommand (& buf , "symbolic-ref" , "--short" , "HEAD" )
4545 if err != nil {
46- return "" , err
46+ return "" , errors . New ( strings . TrimSpace ( buf . String ()))
4747 }
4848 return strings .TrimSpace (buf .String ()), nil
4949}
5050
51- func push () error {
51+ func push () ( string , error ) {
5252 err := repoCheck ()
5353 if err != nil {
54- return fmt . Errorf ( "the current directory is not a git repository" )
54+ return "" , err
5555 }
5656
5757 branch , err := currentBranch ()
5858 if err != nil {
59- return err
59+ return "" , err
6060 }
61- return gitCommand (os .Stdout , "push" , "origin" , branch )
61+ var buf bytes.Buffer
62+ err = gitCommand (& buf , "push" , "origin" , branch )
63+ if err != nil {
64+ return "" , errors .New (strings .TrimSpace (buf .String ()))
65+ }
66+ return strings .TrimSpace (buf .String ()), nil
6267}
6368
6469func commitMessageCheck (f string ) error {
You can’t perform that action at this time.
0 commit comments