Skip to content

hafijulali/gobi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gobi

gobi is a command-line client for interacting with a file browser service. It allows you to upload, download, delete, and list files and directories on the remote server.

Features

  • Intuitive Commands: Simple and easy-to-use commands for file operations.
  • Command Aliases: Shortcuts for common commands (ls, dn, down, up).
  • Smart Directory Handling: Automatically creates and handles directories during uploads and downloads.
  • Cross-Platform: Pre-built binaries for Linux, macOS, and Windows.
  • Concurrent Uploads: Speed up directory uploads with concurrent processing.

Installation

You can download the latest pre-built binaries for your operating system from the GitHub Releases page.

Alternatively, if you have Go installed, you can install gobi from source:

go install hafijul.dev/gobi@latest

This will install the gobi executable in your $GOPATH/bin directory.

Configuration

gobi can be configured using command-line flags or environment variables.

Environment Variables

You can create a .env file in the directory where you run gobi, and the tool will automatically load the environment variables from it. All environment variables must be prefixed with GOBI_.

Example .env file:

GOBI_HOST=http://localhost:8080
GOBI_USERNAME=admin
GOBI_PASSWORD=password
GOBI_TEST_DIR=/tests

The following environment variables are supported:

  • GOBI_HOST: The URL of the file browser service.
  • GOBI_USERNAME: The username for authentication.
  • GOBI_PASSWORD: The password for authentication.
  • GOBI_RECAPTCHA: The Recaptcha token (if required).
  • GOBI_INSECURE: Set to true to allow insecure server connections.
  • GOBI_TEST_DIR: The base directory for running integration tests (defaults to /).

Flags will always take precedence over environment variables.

Usage

The gobi command-line tool provides several subcommands: upload, download, delete, and list.

Global Flags

All commands support the following global flags:

  • -H, --host <url>: The URL of the file browser service (e.g., http://localhost:8080).
  • -u, --username <username>: The username for authentication.
  • -p, --password <password>: The password for authentication.
  • -t, --token <token>: An authentication token (alternative to username/password).

gobi upload (alias: up)

Uploads files or directories to the remote server.

gobi upload [local-path] [remote-path] [flags]

Behavior:

  • If you upload a file to a remote path that is an existing directory, the file will be uploaded inside that directory.
  • If you upload a directory to a remote path that is an existing directory, the local directory will be created inside the remote directory.

Flags:

  • -o, --override: Overwrite existing files on the remote server.
  • -c, --concurrency <number>: Number of concurrent uploads (default: 10).

Examples:

# Upload a single file to a directory
gobi -H http://localhost:8080 -u admin -p password up ./my-local-file.txt /remote/path/to/

# Upload a directory
gobi -H http://localhost:8080 -u admin -p password up ./my-local-dir /remote/path/to/my-dir -o -c 20

gobi download (aliases: dn, down)

Downloads files or directories from the remote server.

gobi download [remote-path] [local-path]

Behavior:

  • If you download a remote directory to a local path that is an existing directory, the remote directory will be created inside the local directory.

Examples:

# Download a single file
gobi -H http://localhost:8080 -u admin -p password down /remote/path/to/my-file.txt ./downloads/my-file.txt

# Download a directory
gobi -H http://localhost:8080 -u admin -p password down /remote/path/to/my-dir ./downloads/

gobi delete

Deletes files or directories on the remote server.

gobi delete [remote-path]

Examples:

# Delete a single file
gobi -H http://localhost:8080 -u admin -p password delete /remote/path/to/delete-me.txt

# Delete an empty directory
gobi -H http://localhost:8080 -u admin -p password delete /remote/path/to/empty-dir

gobi list (alias: ls)

Lists the contents of a directory on the remote server.

gobi list [remote-path]

Examples:

# List the root directory
gobi -H http://localhost:8080 -u admin -p password ls /

# List a specific directory
gobi -H http://localhost:8080 -u admin -p password ls /my-documents

Building from Source

To build the gobi executable from source, clone the repository and run:

go build -o gobi ./app/main.go

About

Cli client for fliebrowser.org

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages