Skip to content

Commit

Permalink
Merge pull request #4 from nao1215/doc/s3hub
Browse files Browse the repository at this point in the history
Add: s3hub command readme
  • Loading branch information
nao1215 authored Dec 23, 2023
2 parents a88e18a + bd20891 commit 9b1d5a3
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
> [!IMPORTANT]
> This project is under development. Do not use it in production environments.
The rainbow project is a toolset for managing AWS resources. This project consists of multiple CLI and CloudFormation templates.
The rainbow project is a toolset for managing AWS resources. This project consists of multiple CLI and CloudFormation templates. This project adopts README-Driven Development. Therefore, while there may be a README, there might not be any code yet. If you have any feedback regarding the README, please write down in the Issues.

## Supported OS & Go version
- Linux
Expand All @@ -23,6 +23,10 @@ The rainbow project is a toolset for managing AWS resources. This project consis

## CLI List
[WIP]
|Name|README|implementation|Description|
|:--|:--|:--|:--|
|[s3hub](./doc/s3hub/README.md)|||user-friendly s3 management tool|


## Template List
[WIP]
Expand All @@ -31,7 +35,7 @@ The rainbow project is a toolset for managing AWS resources. This project consis
This project is licensed under the terms of the MIT license. See the [LICENSE](./LICENSE) file.

## Contributing
Contributions are welcome! Please see [CONTRIBUTING.md](./CONTRIBUTING.md), [Code of Conduct](./CODE_OF_CONDUCT.md) for more information. This project incurs costs on AWS, and financial support from you would make it easier to maintain the project. If you wish to provide financial support, please do so through [GitHub Sponsors](https://github.com/sponsors/nao1215)
Contributions are welcome! Please see [CONTRIBUTING.md](./CONTRIBUTING.md), [Code of Conduct](./CODE_OF_CONDUCT.md), [Principle](./doc/common/principle.md) for more information. This project incurs costs on AWS, and financial support from you would make it easier to maintain the project. If you wish to provide financial support, please do so through [GitHub Sponsors](https://github.com/sponsors/nao1215)

## GitHub Star History
Stars from you motivate me to keep going.
Expand Down
22 changes: 22 additions & 0 deletions doc/common/principle.md
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.
68 changes: 68 additions & 0 deletions doc/s3hub/README.md
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
```

0 comments on commit 9b1d5a3

Please sign in to comment.