Skip to content

Commit a9bbba9

Browse files
committed
chore: update readme to include contributing docs as well as some cleanup
1 parent ffd5e47 commit a9bbba9

File tree

1 file changed

+47
-28
lines changed

1 file changed

+47
-28
lines changed

README.md

Lines changed: 47 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,16 @@ A simple package to execute shell commands on linux, darwin and windows.
1010

1111
## Installation
1212

13+
Install the latest version with:
14+
1315
```bash
14-
$ go get -u github.com/commander-cli/[email protected]
16+
$ go get -u github.com/commander-cli/cmd
17+
```
18+
19+
or an exact version:
20+
21+
```bash
22+
$ go get -u github.com/commander-cli/[email protected]
1523
```
1624

1725
## Usage
@@ -30,19 +38,24 @@ fmt.Println(c.Stderr())
3038

3139
### Configure the command
3240

33-
To configure the command a option function will be passed which receives the command object as an argument passed by reference.
41+
To configure the command an option function can be passed which receives the
42+
command object as an argument passed by reference.
3443

3544
Default option functions:
3645

37-
- `cmd.WithCustomBaseCommand(*exec.Cmd)`
38-
- `cmd.WithStandardStreams`
39-
- `cmd.WithCustomStdout(...io.Writers)`
40-
- `cmd.WithCustomStderr(...io.Writers)`
41-
- `cmd.WithTimeout(time.Duration)`
42-
- `cmd.WithoutTimeout`
43-
- `cmd.WithWorkingDir(string)`
44-
- `cmd.WithEnvironmentVariables(cmd.EnvVars)`
45-
- `cmd.WithInheritedEnvironment(cmd.EnvVars)`
46+
```
47+
cmd.WithCustomBaseCommand(*exec.Cmd)
48+
cmd.WithStandardStreams
49+
cmd.WithCustomStdout(...io.Writers)
50+
cmd.WithCustomStderr(...io.Writers)
51+
cmd.WithTimeout(time.Duration)
52+
cmd.WithoutTimeout
53+
cmd.WithWorkingDir(string)
54+
cmd.WithEnvironmentVariables(cmd.EnvVars)
55+
cmd.WithInheritedEnvironment(cmd.EnvVars)
56+
```
57+
58+
See [godocs for details][].
4659

4760
#### Example
4861

@@ -62,31 +75,37 @@ c := cmd.NewCommand("pwd", setWorkingDir)
6275
c.Execute()
6376
```
6477

65-
### Testing
78+
## Contributing
6679

67-
You can catch output streams to `stdout` and `stderr` with `cmd.CaptureStandardOut`.
80+
If you would like to contribute please submit a pull request.
81+
For bug fixes/minor changes a simple pull request will
82+
suffice. If the change is large or you would like to have a feature
83+
discussion before implementation feel free to open an issue.
6884

69-
```golang
70-
// caputred is the captured output from all executed source code
71-
// fnResult contains the result of the executed function
72-
captured, fnResult := cmd.CaptureStandardOut(func() interface{} {
73-
c := NewCommand("echo hello", cmd.WithStandardStream)
74-
err := c.Execute()
75-
return err
76-
})
85+
If you have a feature request or bug report please open an issue.
7786

78-
// prints "hello"
79-
fmt.Println(captured)
80-
```
87+
### Development
8188

82-
## Development
89+
Please fork the project and do your development there. Please use a
90+
meaningful branch name as well as adhere to [commitlint rules][].
8391

84-
### Running tests
92+
If you would like the precommit hooks run:
93+
94+
```
95+
make init
96+
```
97+
98+
To run the test suite:
8599

86100
```
87101
make test
88102
```
89103

90-
### ToDo
104+
*Reminder:* The goal of this project is to ensure we abstract the OS specific
105+
command execution as mush as possible. Ensure your change is compatible
106+
with linux, windows and osx. If unable to test on every operating system
107+
(help needed for windows (:) the CI will take care of that for you.
108+
109+
[commitlint rules]: https://www.conventionalcommits.org/en/v1.0.0/
110+
[godocs for details]: https://godoc.org/github.com/commander-cli/cmd
91111

92-
- os.Stdout and os.Stderr output access after execution via `c.Stdout()` and `c.Stderr()`

0 commit comments

Comments
 (0)