Skip to content

interserver/go-is-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

To set up:

  • mkdir go-is-cli
  • cd go-is-cli
  • go mod init is
  • go get github.com/schollz/progressbar/v3
  • go get github.com/urfave/cli/v2
  • go get github.com/cheggaaa/pb/v3

auth is stored in $HOME/.is-cli.json


### Building and Running

1.  **Build the binary:**
    ```bash
    CGO_ENABLED=0 go build -ldflags="-s -w" -o is main.go
    ```

2.  **Setup Authentication:**
    Run this once to save your server details.
    ```bash
    ./is auth
    ```
    * **Server URL:** `https://storage3800.is.cc:8080`
    * **Username:** `YOURUSER`
    * **Password:** `YOUR PASSWORD`

3.  **Use the Tool:**

    * **List files:**
        ```bash
        ./is ls
        ./is ls tmp
        ```

    * **Upload a file (with progress bar):**
        ```bash
        ./is put local-image.jpg tmp/
        ```

    * **Download a file (with progress bar):**
        ```bash
        ./is get tmp/local-image.jpg
        ```

    * **Remove a file:**
        ```bash
        ./is rm tmp/local-image.jpg


Help:
NAME:
   is - CLI for IS storage service (Official API)

USAGE:
   is [global options] command [command options]

COMMANDS:
   auth              Configure credentials
   ls, list          List files (GET /list)
   stat              Get file info (GET /stat)
   upload, put, p    Upload file (POST /upload)
   download, get, g  Download file (GET /download)
   delete, rm        Delete file (POST /delete)
   mkdir             Create directory (POST /mkdir)
   rename, mv        Rename file (POST /rename)
   health            Check server health (GET /healthz)
   help, h           Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --server value, -s value  Server URL (default: "https://storage4000.is.cc:8080") [$IS_SERVER]
   --help, -h                show help


Updates:

Pretty Colors: The ls output now uses ANSI colors (Blue/Bold for directories, formatting for headers) while maintaining perfect column alignment by using tabwriter's escape sequence handling.

--json Flag: I added the --json flag (aliased to --raw) so you can now run ./is ls --json to get the raw JSON output as requested.

sample upload:
  ./is upload 100MB.bin
100.00 MiB / 100.00 MiB [----------------------------------------------------------------------------------------------------------------] 100.00% 51.31 MiB p/s 2.1s
Upload successful. Response: {"ok":true,"status":204,"body":"","err":""}

About

CLI for IS storage service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages