README
¶
Directory trees of S3
Overview
stree
is a CLI tool designed to visualize the directory tree structure of an S3 bucket.
By inputting an S3 bucket/prefix and utilizing various flags to customize your request, you can obtain a colorized or non-colorized directory tree right in your terminal.
Whether it's for verifying the file structure, sharing the structure with your team, or any other purpose, stree
offers an easy and convenient way to explore your S3 buckets.
Features
- Colorized Output: By default,
stree
provides a colorized tree structure, making it easy to differentiate between directories and files at a glance. This feature can be turned off with the-n
or--no-color
flag. - LocalStack Support:
stree
supports local testing with LocalStack, a fully functional local AWS cloud stack, thanks to the--local
and--endpoint-url
flags. - Custom AWS Profile and Region: Specify the AWS profile and region with the
--profile
and--region
flags to override the default settings as needed. - Ease of Installation: Install
stree
via Go, Homebrew, or by downloading the latest compiled binaries from the GitHub releases page.
Install
Go
go install github.com/orangekame3/stree@latest
Homebrew
brew install orangekame3/tap/stree
Download
Download the latest compiled binaries and put it anywhere in your executable path.
How to Use
Warning Prerequisite You must set up the config and credentials to be used with aws cli in advance
From here on, it is assumed that the config and credentials are set as follows.
~/.aws/config
[my_profile]
region = ap-northeast-1
output = json
~/.aws/credentials
[my_profile]
aws_access_key_id=XXXXXXXXXXXXXXXXXXXXX
aws_secret_access_key=XXXXXXXXXXXXXXXXX
Basic Commands
Specify the bucket name and profile, and execute the following command. The profile is specified with --profile (-p)
.
stree my-bucket -p my_profile
You will get the following output.
my-bucket
└── test
├── dir1
│ ├── dir1_1
│ │ └── dir1_1_1
│ │ ├── file1.csv
│ │ └── file2.csv
│ └── dir1_2
│ ├── file1.csv
│ ├── file2.csv
│ └── file3.csv
├── dir2
│ └── dir2_1
│ └── dir2_1_1
│ ├── file1.csv
│ ├── file2.csv
│ └── file3.csv
└── dir3
├── file1.csv
└── file2.csv
9 directories, 10 files
Specifying Prefix
stree my-bucket/test/dir2 -p my_profile
The result of executing this command is as follows.
my-bucket
└── test
└── dir2
└── dir2_1
└── dir2_1_1
├── file1.csv
├── file2.csv
└── file3.csv
4 directories, 3 files
Overriding Region
You can specify the region with --region (-r)
. Use the --region
flag to override when you want to specify a region other than the one listed in the profile.
Usage with Localstack
It can also be used with Localstack. When using it with Localstack, the endpoint and region are set to the following by default.
endpoint = http://localhost:4566
region = us-east-1
Since the majority of cases are expected to use the above settings, we have added a flag for Localstack, which is --local (-l)
.
stree my-bucket/test/dir2 -l
In case you need to change the endpoint and region due to special circumstances, you can override with --region (-r)
flag and --endpoint (-e)
.
stree my-bucket/test/dir2 -r us-east-1 -e http://localhost:4537
Disable Color Output
You can disable color output with --no-color (-n)
.
With color
Without color
Usage
Usage:
stree [bucket/prefix] [flags]
Flags:
-e, --endpoint-url string AWS endpoint URL to use (useful for local testing with LocalStack) (default "http://localhost:4566")
-h, --help help for stree
-l, --local Use LocalStack configuration
-n, --no-color Disable colorized output
-p, --profile string AWS profile to use (default "local")
-r, --region string AWS region to use (overrides the region specified in the profile) (default "us-east-1")
License
stree
is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
The concept of "stree" was inspired by the pioneering work seen in gtree. I'm grateful for the inspiration.
Documentation
¶
Overview ¶
Copyright © 2023 Takafumi Miyanaga <miya.org.0309@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright © 2023 Takafumi Miyanaga <miya.org.0309@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Directories
¶
Path | Synopsis |
---|---|
Package cmd is a command line tool for visualizing the structure of S3 buckets
|
Package cmd is a command line tool for visualizing the structure of S3 buckets |
Package pkg provides the core functionality of the program.
|
Package pkg provides the core functionality of the program. |