storctl
storctl is a command-line tool for managing and interacting with the STOR object store. It provides essential functionality for managing objects and buckets with a simple, intuitive interface.
Features
- List buckets: View available buckets.
- Create buckets: Add new storage buckets.
- Remove buckets: Delete empty buckets.
- List objects: Browse contents of a bucket.
- Copy objects: Transfer objects between locations.
- Move objects: Relocate objects across buckets or paths.
- Remove objects: Delete specific objects from buckets.
Installation
From Source
- Ensure you have Go installed (version 1.23 or higher).
- Clone the repository:
git clone https://github.com/cfichtmueller/storctl.git
- Build the binary using the Makefile:
cd storctl
make binary
- Move the binary to a directory in your
PATH (e.g., /usr/local/bin).
Usage
storctl commands follow the syntax:
storctl <command> [arguments] [options]
Commands and Examples
List buckets (lb)
storctl lb
Example:
storctl lb
# Output:
# NAME OBJECTS SIZE
# mybucket 8 1405614
# another-bucket 3 3160277
Create a bucket (mb)
storctl mb <bucket>
Example:
storctl mb newbucket
Remove a bucket (rb)
storctl rb <bucket>
Example:
storctl rb oldbucket
List objects (ls)
storctl ls <bucket>
Example:
storctl ls mybucket
# Output:
# file1.txt
# file2.txt
Copy an object (cp)
storctl cp <source> <destination>
Example:
storctl cp stor://mybucket/file1.txt stor://mybucket-backup/file1.txt
storctl cp file1.txt stor:///mybucket/file1.txt
Move an object (mv)
storctl mv <source> <destination>
Example:
storctl mv stor://mybucket/file1.txt stor://mybucket-archive/file1.txt
Remove an object (rm)
storctl rm <bucket> <key>
Example:
storctl rm mybucket file1.txt
Configuration Management Commands
- Create a configuration context:
storctl config create-context <context-name>
- Delete a configuration context:
storctl config delete-context <context-name>
- List all configuration contexts:
storctl config get-contexts
- Rename a configuration context:
storctl config rename-context <old-name> <new-name>
- Set credentials in a context:
storctl config set-credentials <context-name> --api-key <key>
- Use a specific configuration context:
storctl config use-context <context-name>
Initial Configuration
When you first run storctl, an empty configuration file is created automatically in your home directory. Use the config commands above to manage your configuration contexts.
License
This project is licensed under the MIT License. See the LICENSE file for details.