Skip to content

Commit b7f1d23

Browse files
authored
Merge pull request #120 from neo4j/cli-guidelines
Add basic guidelines for cli development
2 parents 156fc6c + fcc79b7 commit b7f1d23

File tree

2 files changed

+117
-52
lines changed

2 files changed

+117
-52
lines changed

CONTRIBUTING.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Contributing
2+
3+
Thanks for your interest in contributing to the Neo4j Aura CLI, [issues](https://github.com/neo4j/aura-cli/issues) and [pull requests](https://github.com/neo4j/aura-cli/pulls) are welcome.
4+
5+
If you want to contribute code, make sure to [sign the CLA](https://neo4j.com/developer/contributing-code/#sign-cla).
6+
7+
## Development
8+
9+
### Testing
10+
11+
The full suite of tests can be run using the following command:
12+
13+
```bash
14+
go test ./...
15+
```
16+
17+
### Local running
18+
19+
The CLI can be run locally without building by running the following command:
20+
21+
```bash
22+
go run neo4j-cli/main.go aura-cli
23+
```
24+
25+
### Pull requests
26+
27+
As well as your code changes, pull requests need a changelog entry. These are added using the tool [`changie`](https://changie.dev/). You will need to install this using the following command:
28+
29+
```bash
30+
go install github.com/miniscruff/changie@latest
31+
```
32+
33+
With this installed, the following command will guide through the process of adding a changelog entry:
34+
35+
```bash
36+
changie new
37+
```
38+
39+
Simply commit the file that this command produces and you're done!
40+
41+
### Building
42+
43+
Builds for releases are handled in GitHub Actions. If you want to create local builds, there are a couple of approaches.
44+
45+
To create a simply binary using `go` directly, you can execute the following command:
46+
47+
```bash
48+
go build -o bin/ ./...
49+
```
50+
51+
If you want to build binaries for all varieties of platforms, you can do so with the following command:
52+
53+
```bash
54+
GORELEASER_CURRENT_TAG=dev goreleaser release --snapshot --clean
55+
```
56+
57+
In the above command, `GORELEASER_CURRENT_TAG` can be substituted for any version of your choosing.
58+
59+
## CLI Guidelines
60+
61+
The Aura CLI aims to provide a consistent and reliable experience to the end user. Any change made to the CLI must comform to the following guidelines:
62+
63+
- All commandds must be singular
64+
-`aura-cli instance`
65+
-`aura-cli instances`
66+
- Output should support the following options:
67+
- `json`: Provides the raw JSON output of the API, formatted to be human-readable.
68+
- `table`: Provides a subset of the output, formatted to be human readable on a table. Try to keep the table output below 120 characters to avoid overflowing the screen.
69+
- Flags, if set, take precedence over global configuration or default values
70+
71+
> These guidelines are based on https://clig.dev
72+
73+
### Structure
74+
75+
Aura CLI is divided in top level commands, for example:
76+
77+
- `instance`
78+
- `config`
79+
80+
Each of these commands handle a certain resource of the API and have several subcommands for the actions, for example:
81+
82+
- `instance list`
83+
- `instance get`
84+
85+
Nested subcommands are also allowed, for example:
86+
87+
- `instance snapshot list`
88+
89+
### Common subcommands
90+
91+
Most commands targetting API resources contain some of the following subcommands as actions:
92+
93+
- `get`
94+
- `list`
95+
- `delete`
96+
- `create`
97+
98+
Commands may also have some extra, specific commands, such as `instance pause`.
99+
100+
For asynchronous operations (i.e. operations that trigger a job that won't be finished in the same request), the flag `--await` can be used to wait until the operation has been completed, generally polling for the status. If this flag is not set, all operations must finish when the request has been completed, even if a job is pending.
101+
102+
## Resources
103+
104+
- [CLI Usage Guide](./docs/usageGuide/A%20Guide%20To%20The%20New%20Aura%20CLI.md).
105+
- [Neo4j Aura API](https://neo4j.com/docs/aura/platform/api/specification/)
106+
- https://clig.dev

README.md

Lines changed: 11 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -26,76 +26,35 @@ You can then, for example, list your instances in a table format:
2626
./aura-cli instance list --output table
2727
```
2828

29-
If you would rather just type ```aura-cli``` then move the aura-cli binary into the file path of your computer.
29+
If you would rather just type `aura-cli` then move the aura-cli binary into the file path of your computer.
3030
Windows:
31+
3132
```bash
3233
move aura-cli c:\windows\system32
3334
```
35+
3436
Mac:
37+
3538
```bash
3639
sudo mv aura-cli /usr/local/bin
3740
```
3841

3942
To see all of the available commands:
40-
```bash
41-
./aura-cli
42-
```
43-
Help for each command is accessed by using it without any flags or options. For example, to see help creating an instance
44-
```bash
45-
./aura-cli instance create
46-
```
47-
48-
## Feedback / Issues
49-
Please use [GitHub issues](https://github.com/neo4j/aura-cli/issues) to provide feedback and report any issues that you have encountered.
50-
51-
## Development
52-
53-
### Testing
54-
55-
The full suite of tests can be run using the following command:
5643

5744
```bash
58-
go test ./...
59-
```
60-
61-
### Local running
62-
63-
The CLI can be run locally without building by running the following command:
64-
65-
```bash
66-
go run neo4j-cli/main.go aura-cli
67-
```
68-
69-
### Pull requests
70-
71-
As well as your code changes, pull requests need a changelog entry. These are added using the tool [`changie`](https://changie.dev/). You will need to install this using the following command:
72-
73-
```bash
74-
go install github.com/miniscruff/changie@latest
45+
./aura-cli
7546
```
7647

77-
With this installed, the following command will guide through the process of adding a changelog entry:
48+
Help for each command is accessed by using it without any flags or options. For example, to see help creating an instance
7849

7950
```bash
80-
changie new
51+
./aura-cli instance create
8152
```
8253

83-
Simply commit the file that this command produces and you're done!
84-
85-
### Building
86-
87-
Builds for releases are handled in GitHub Actions. If you want to create local builds, there are a couple of approaches.
88-
89-
To create a simply binary using `go` directly, you can execute the following command:
90-
91-
```bash
92-
go build -o bin/ ./...
93-
```
54+
## Feedback / Issues
9455

95-
If you want to build binaries for all varieties of platforms, you can do so with the following command:
56+
Please use [GitHub issues](https://github.com/neo4j/aura-cli/issues) to provide feedback and report any issues that you have encountered.
9657

97-
```bash
98-
GORELEASER_CURRENT_TAG=dev goreleaser release --snapshot --clean
99-
```
58+
## Developing and contributing
10059

101-
In the above command, `GORELEASER_CURRENT_TAG` can be substituted for any version of your choosing.
60+
Read [CONTRIBUTING.md](./CONTRIBUTING.md)

0 commit comments

Comments
 (0)