-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from nao1215/doc/s3hub
Add: s3hub command readme
- Loading branch information
Showing
3 changed files
with
96 additions
and
2 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
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,22 @@ | ||
## Principle | ||
### Maintain a Simple Interface | ||
In the context of the command line interface, the interface consists of arguments, options, and option arguments. Users prefer not to deal with complex commands. Developers should always consider whether it is possible to reduce the number of arguments or options. | ||
|
||
|
||
### Users: Humans and Computers | ||
There are two types of users: humans and computers. | ||
|
||
When developers introduce interactive interfaces for humans, they should also provide means for computers to achieve the same objectives. Specifically, design the system to allow achieving goals by executing commands from shell scripts or GitHub Actions. | ||
|
||
|
||
### Don't Stay Silent | ||
In the book "The UNIX Philosophy," there's a section titled "Avoid unnecessary output." The concept of "Avoid unnecessary output" suggests that unnecessary output should not be produced when a command succeeds. | ||
|
||
While I appreciate this philosophy, I am not fond of applications that produce no logs whatsoever during execution. It makes me uneasy. In situations where the application remains silent for an extended period, especially when the Rainbow project's commands may alter the infrastructure, having logs during the changes is preferable and more user-friendly. | ||
|
||
### Prompt for User Confirmation | ||
Changes to the infrastructure can be irreversible, so it's important to be cautious. Therefore, consider the following points: | ||
|
||
- When making irreversible changes, obtain user consent through keyboard input. | ||
- Provide the option to skip confirmation using the --force (-f) option (computers may find it challenging to interactively provide consent). | ||
- Allow users to perform a pre-check of the operation with the --dry-run (-n) option. |
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,68 @@ | ||
## s3hub - user-friendly s3 management tool | ||
> [!IMPORTANT] | ||
> Not implemented yet. | ||
The s3hub command provides following features: | ||
- Create a bucket | ||
- List buckets | ||
- List contents of a bucket | ||
- Copy files to a bucket | ||
- Delete contents from a bucket | ||
- Delete a bucket | ||
|
||
## How to install | ||
```shell | ||
go install github.com/nao1215/rainbow/cmd/s3hub@latest | ||
``` | ||
|
||
## How to use | ||
S3hub operates without requiring the 's3://' protocol to be added to the bucket name. | ||
|
||
### Create a bucket(s) | ||
|
||
```shell | ||
s3hub mb ${YOUR_BUCKET_NAME} | ||
``` | ||
|
||
### List buckets | ||
```shell | ||
s3hub ls | ||
``` | ||
|
||
### List contents of a bucket | ||
```shell | ||
s3hub ls ${YOUR_BUCKET_NAME} | ||
``` | ||
|
||
### Copy files to a bucket | ||
From local to S3: | ||
```shell | ||
s3hub cp ${YOUR_FILE_PATH} ${YOUR_BUCKET_NAME} | ||
``` | ||
|
||
From S3 to local: | ||
```shell | ||
s3hub cp ${YOUR_BUCKET_NAME} ${YOUR_FILE_PATH} | ||
``` | ||
|
||
### Delete contents from a bucket | ||
If you want to delete a specific file(s), use the following command: | ||
```shell | ||
s3hub rm ${CONTENT_PATH_IN_BUCKET} | ||
``` | ||
|
||
If you want to delete all contents in a bucket, use the wildcard: | ||
```shell | ||
s3hub rm ${YOUR_BUCKET_NAME}/* | ||
``` | ||
|
||
### Delete a bucket(s) | ||
```shell | ||
s3hub rm --recursive ${YOUR_BUCKET_NAME} | ||
``` | ||
|
||
### Interactive mode | ||
You can use the interactive mode by omitting the arguments. | ||
```shell | ||
s3hub | ||
``` |