cfpan-cli
v0.1.5
Published
CLI tool for CFpan - self-hosted netdisk on Cloudflare Workers
Maintainers
Readme
cfpan-cli
CLI tool for CFpan - self-hosted netdisk on Cloudflare Workers.
Installation
npm install -g cfpan-cliQuick Start
# Login to your CFpan instance
cfpan login https://your-cfpan-domain.com
# List files
cfpan ls
# Upload a file
cfpan upload ./local-file.txt /remote/path.txt
# Upload a directory with aggregate progress and three concurrent transfers
cfpan upload ./photos /remote/photos --recursive --concurrency 3
# Download a file
cfpan download /remote/file.txt ./local-file.txt
# Create a share link
cfpan share /path/to/file
# Generate shell completion (zsh example)
cfpan completion zsh > ~/.zsh/completions/_cfpanCommands
Authentication
cfpan login <endpoint>- Login to CFpan instancecfpan logout- Revoke the current token and remove the local sessioncfpan profile list|use|current|remove- Manage local profiles
File Operations
cfpan ls [path]- List files and folderscfpan upload <local> <remote>- Upload a file or directorycfpan download <remote> <local>- Download a file or directory atomicallycfpan mkdir <path>- Create foldercfpan rm <path>- Delete file/folder (move to trash)cfpan rm --permanent <path>- Permanently delete file/foldercfpan restore <path>- Restore file/folder from trash
Upload/download support --recursive, --concurrency <n>,
--continue-on-error, and upload --conflict reject|overwrite|rename|skip.
Recursive uploads preserve the source directory name below the remote target;
recursive downloads preserve the selected remote directory name below the local
destination when that destination already exists as a directory.
Global options include --json, --quiet, --no-color,
--progress auto|always|never, --yes, --non-interactive, and
--profile <name>. JSON results are written to stdout and errors to stderr.
Shell Completion
Generate a completion script for the shell you use:
# bash
cfpan completion bash > ~/.local/share/bash-completion/completions/cfpan
# zsh
cfpan completion zsh > ~/.zsh/completions/_cfpan
# fish
cfpan completion fish > ~/.config/fish/completions/cfpan.fish
# PowerShell
cfpan completion powershell > $HOME/.config/powershell/cfpan-completion.ps1The generated scripts complete commands and options locally. When a profile is available, remote path candidates are queried through the hidden completion endpoint; completion remains silent while offline or logged out.
Sharing
cfpan share <path>- Create share linkcfpan share <path> --code <6-digit>- Create share with access code
Configuration
Configuration is stored in ~/.cfpan/config.json:
{
"profiles": {
"default": {
"endpoint": "https://your-cfpan.com",
"token": "cfpan_xxxxx",
"tokenId": "uuid-of-token"
}
},
"activeProfile": "default"
}For non-interactive login, set CFPAN_PASSWORD and pass --username; the password is never accepted as a command-line argument.
License
MIT
