-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add
get
tag to files
section: get
describe GET
request for re…
…mote storage
- Loading branch information
Showing
14 changed files
with
355 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
name: Go package | ||
name: Test | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
test: | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package proc | ||
|
||
import ( | ||
"bytes" | ||
"fmt" | ||
"os/exec" | ||
"strings" | ||
|
||
"github.com/kozmod/progen/internal/entity" | ||
) | ||
|
||
type RunCommandProc struct { | ||
commands []entity.Command | ||
logger entity.Logger | ||
} | ||
|
||
func NewRunCommandProc(commands []entity.Command, logger entity.Logger) *RunCommandProc { | ||
return &RunCommandProc{ | ||
commands: commands, | ||
logger: logger, | ||
} | ||
} | ||
|
||
func (p *RunCommandProc) Exec() error { | ||
for _, command := range p.commands { | ||
cmd := exec.Command(command.Cmd, command.Args...) | ||
var out bytes.Buffer | ||
cmd.Stdout = &out | ||
err := cmd.Run() | ||
if err != nil { | ||
return fmt.Errorf("run command: %w", err) | ||
} | ||
p.logger.Infof("execute:\ncmd: %s\nout: %s", | ||
strings.Join(append([]string{command.Cmd}, command.Args...), entity.Space), | ||
out.String()) | ||
} | ||
return nil | ||
} |
Oops, something went wrong.