Repository: timvisee/ffsend Branch: master Commit: 85aae2f3e83a Files: 101 Total size: 637.0 KB Directory structure: gitextract_5263lj6x/ ├── .gitattributes ├── .github/ │ └── FUNDING.yml ├── .gitignore ├── .gitlab-ci.yml ├── .travis.yml ├── CONTRIBUTING.md ├── Cargo.toml ├── LICENSE ├── README.md ├── SECURITY.md ├── appveyor.yml ├── build.rs ├── contrib/ │ ├── completions/ │ │ ├── _ffsend │ │ ├── _ffsend.ps1 │ │ ├── ffsend.bash │ │ ├── ffsend.elv │ │ ├── ffsend.fish │ │ └── gen_completions │ └── util/ │ └── nautilus/ │ ├── README.md │ └── firefox-send ├── pkg/ │ ├── alpine/ │ │ └── APKBUILD │ ├── aur/ │ │ ├── aur.pub │ │ ├── ffsend/ │ │ │ └── PKGBUILD │ │ ├── ffsend-bin/ │ │ │ └── PKGBUILD │ │ └── ffsend-git/ │ │ └── PKGBUILD │ ├── choco/ │ │ └── ffsend/ │ │ ├── ffsend.nuspec │ │ └── tools/ │ │ ├── LICENSE.txt │ │ └── VERIFICATION.txt │ ├── create_deb │ ├── deb/ │ │ ├── postinst │ │ └── prerm │ ├── docker/ │ │ └── Dockerfile │ └── scoop/ │ ├── README.md │ └── ffsend.json ├── res/ │ ├── asciinema-demo.json │ └── asciinema-to-svg └── src/ ├── action/ │ ├── debug.rs │ ├── delete.rs │ ├── download.rs │ ├── exists.rs │ ├── generate/ │ │ ├── completions.rs │ │ └── mod.rs │ ├── history.rs │ ├── info.rs │ ├── mod.rs │ ├── params.rs │ ├── password.rs │ ├── upload.rs │ └── version.rs ├── archive/ │ ├── archive.rs │ ├── archiver.rs │ └── mod.rs ├── client.rs ├── cmd/ │ ├── arg/ │ │ ├── api.rs │ │ ├── basic_auth.rs │ │ ├── download_limit.rs │ │ ├── expiry_time.rs │ │ ├── gen_passphrase.rs │ │ ├── host.rs │ │ ├── mod.rs │ │ ├── owner.rs │ │ ├── password.rs │ │ └── url.rs │ ├── handler.rs │ ├── matcher/ │ │ ├── debug.rs │ │ ├── delete.rs │ │ ├── download.rs │ │ ├── exists.rs │ │ ├── generate/ │ │ │ ├── completions.rs │ │ │ └── mod.rs │ │ ├── history.rs │ │ ├── info.rs │ │ ├── main.rs │ │ ├── mod.rs │ │ ├── params.rs │ │ ├── password.rs │ │ ├── upload.rs │ │ └── version.rs │ ├── mod.rs │ └── subcmd/ │ ├── debug.rs │ ├── delete.rs │ ├── download.rs │ ├── exists.rs │ ├── generate/ │ │ ├── completions.rs │ │ └── mod.rs │ ├── history.rs │ ├── info.rs │ ├── mod.rs │ ├── params.rs │ ├── password.rs │ ├── upload.rs │ └── version.rs ├── config.rs ├── error.rs ├── history.rs ├── history_tool.rs ├── host.rs ├── main.rs ├── progress.rs ├── urlshorten.rs └── util.rs ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitattributes ================================================ # Mark generated completion files as vendored contrib/completions/* linguist-vendored contrib/completions/gen_completions linguist-vendored=false ================================================ FILE: .github/FUNDING.yml ================================================ # Funding links github: - timvisee custom: - "https://timvisee.com/donate" patreon: timvisee ko_fi: timvisee ================================================ FILE: .gitignore ================================================ .*.sw[po] target/ **/*.rs.bk .idea/ snapcraft.login ================================================ FILE: .gitlab-ci.yml ================================================ # GitLab CI configuration for ffsend builds, tests and releases # # To add a new release: # - configure a new 'build-*' job with the proper target # - export a build artifact from the new job # - manually upload artifact to GitHub in the 'github-release' job image: "rust:slim-bookworm" stages: - check - build - test - release - package # Variable defaults variables: RUST_VERSION: stable RUST_TARGET: x86_64-unknown-linux-gnu # Cache rust/cargo/build artifacts cache: key: "$CI_PIPELINE_ID-$RUST_VERSION" paths: - /usr/local/cargo/registry/ - /usr/local/rustup/toolchains/ - /usr/local/rustup/update-hashes/ - target/ # Install compiler and OpenSSL dependencies before_script: - apt-get update - apt-get install -y --no-install-recommends build-essential pkg-config libssl-dev - | rustup install $RUST_VERSION rustup default $RUST_VERSION - | rustc --version cargo --version # Check on stable, beta and nightly .check-base: &check-base stage: check script: - cargo check --verbose - cargo check --no-default-features --features send3,crypto-ring --verbose - cargo check --no-default-features --features send2,crypto-openssl --verbose - cargo check --no-default-features --features send3,crypto-openssl --verbose - cargo check --no-default-features --features send2,send3,crypto-openssl --verbose - cargo check --no-default-features --features send3,crypto-ring,archive --verbose - cargo check --no-default-features --features send3,crypto-ring,history --verbose - cargo check --no-default-features --features send3,crypto-ring,qrcode --verbose - cargo check --no-default-features --features send3,crypto-ring,urlshorten --verbose - cargo check --no-default-features --features send3,crypto-ring,infer-command --verbose - cargo check --features no-color --verbose check-stable: <<: *check-base check-beta: <<: *check-base variables: RUST_VERSION: beta check-nightly: <<: *check-base variables: RUST_VERSION: nightly check-msrv: <<: *check-base variables: RUST_VERSION: "1.63.0" # Build using Rust stable build-x86_64-linux-gnu: stage: build needs: [] script: - cargo build --target=$RUST_TARGET --release --verbose - mv target/$RUST_TARGET/release/ffsend ./ffsend-$RUST_TARGET - strip -g ./ffsend-$RUST_TARGET artifacts: name: ffsend-x86_64-linux-gnu paths: - ffsend-$RUST_TARGET expire_in: 1 month # Build a static version build-x86_64-linux-musl: stage: build needs: [] variables: RUST_TARGET: x86_64-unknown-linux-musl script: # Install the static target - rustup target add $RUST_TARGET # Build OpenSSL statically - apt-get install -y build-essential wget musl-tools - wget https://github.com/openssl/openssl/releases/download/openssl-3.0.15/openssl-3.0.15.tar.gz - tar xzvf openssl-3.0.15.tar.gz - cd openssl-3.0.15 - ./config no-async -fPIC --openssldir=/usr/local/ssl --prefix=/usr/local - make - make install - cd .. # Statically build ffsend - export OPENSSL_STATIC=1 - export OPENSSL_LIB_DIR=/usr/local/lib64 - export OPENSSL_INCLUDE_DIR=/usr/local/include - cargo build --target=$RUST_TARGET --release --verbose # Prepare the release artifact, strip it - find . -name ffsend -exec ls -lah {} \; - mv target/$RUST_TARGET/release/ffsend ./ffsend-$RUST_TARGET - strip -g ./ffsend-$RUST_TARGET artifacts: name: ffsend-x86_64-linux-musl paths: - ffsend-$RUST_TARGET expire_in: 1 month # Run the unit tests through Cargo test-cargo: stage: test needs: [] dependencies: [] script: - cargo test --verbose # Run integration test with the public Send service test-public: image: alpine:latest stage: test dependencies: - build-x86_64-linux-musl variables: GIT_STRATEGY: none RUST_TARGET: x86_64-unknown-linux-musl before_script: [] script: # Prepare ffsend binary, create random file - mv ./ffsend-$RUST_TARGET ./ffsend - chmod a+x ./ffsend - head -c1m test.txt # Generate random file, upload/download and assert equality - ./ffsend upload test.txt -I - ./ffsend download $(./ffsend history -q) -I -o=download.txt - "cmp -s ./test.txt ./download.txt || (echo ERROR: Downloaded file is different than original; exit 1)" - rm ./download.txt # Cargo crate release release-crate: stage: release dependencies: [] only: - /^v(\d+\.)*\d+$/ script: - echo "Creating release crate to publish on crates.io..." - echo $CARGO_TOKEN | cargo login - echo "Publishing crate to crates.io..." - cargo publish --verbose --allow-dirty # Snap release release-snap: image: snapcore/snapcraft:stable stage: release dependencies: [] only: - /^v(\d+\.)*\d+$/ before_script: [] script: # Prepare the environment - apt-get update -y - apt-get install python3 -yqq - cd pkg/snap # Update version number in snapcraft.yaml - VERSION=$(echo $CI_COMMIT_REF_NAME | cut -c 2-) - echo "Determined binary version number 'v$VERSION', updating snapcraft.yaml..." - 'sed "s/^version:.*\$/version: $VERSION/" -i snapcraft.yaml' - 'sed "s/^pkgver=.*\$/pkgver=$VERSION/" -i snapcraft.yaml' # Build the package - echo "Building snap package..." - snapcraft # Publish snap package - echo "Publishing snap package..." - snapcraft whoami - snapcraft push --release=stable ffsend_*_amd64.snap artifacts: name: ffsend-snap-x86_64 paths: - pkg/snap/ffsend_*_amd64.snap expire_in: 1 month # Publish release binaries to as GitHub release release-github: stage: release only: - /^v(\d+\.)*\d+$/ dependencies: - build-x86_64-linux-gnu - build-x86_64-linux-musl before_script: [] script: # Install dependencies - apt-get update - apt-get install -y curl wget gzip netbase # Download github-release binary - wget https://github.com/tfausak/github-release/releases/download/1.2.5/github-release-linux.gz -O github-release.gz - gunzip github-release.gz - chmod a+x ./github-release # Create the release, upload binaries - ./github-release release --token "$GITHUB_TOKEN" --owner timvisee --repo ffsend --tag "$CI_COMMIT_REF_NAME" --title "ffsend $CI_COMMIT_REF_NAME" - ./github-release upload --token "$GITHUB_TOKEN" --owner timvisee --repo ffsend --tag "$CI_COMMIT_REF_NAME" --file ./ffsend-x86_64-unknown-linux-gnu --name ffsend-$CI_COMMIT_REF_NAME-linux-x64 - ./github-release upload --token "$GITHUB_TOKEN" --owner timvisee --repo ffsend --tag "$CI_COMMIT_REF_NAME" --file ./ffsend-x86_64-unknown-linux-musl --name ffsend-$CI_COMMIT_REF_NAME-linux-x64-static # Publish a Docker image release-docker: image: docker:git stage: release only: - /^v(\d+\.)*\d+$/ dependencies: - build-x86_64-linux-musl services: - docker:dind variables: RUST_TARGET: x86_64-unknown-linux-musl DOCKER_HOST: tcp://docker:2375 # DOCKER_DRIVER: overlay2 before_script: [] script: # Place binary in Docker directory, change to it - mv ./ffsend-$RUST_TARGET ./pkg/docker/ffsend - cd ./pkg/docker # Build the Docker image, run it once to test - docker build -t timvisee/ffsend:latest ./ - docker run --rm timvisee/ffsend:latest -V # Retag version - VERSION=$(echo $CI_COMMIT_REF_NAME | cut -c 2-) - echo "Determined Docker image version number 'v$VERSION', retagging image..." - docker tag timvisee/ffsend:latest timvisee/ffsend:$VERSION # Authenticate and push the Docker images - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USER" --password-stdin - docker push timvisee/ffsend:$VERSION - docker push timvisee/ffsend:latest # AUR packages release package-aur: image: archlinux stage: package needs: - release-github dependencies: [] only: - /^v(\d+\.)*\d+$/ before_script: [] script: - cd ./pkg/aur # Determine the version number we're releasing for - VERSION=$(echo $CI_COMMIT_REF_NAME | cut -c 2-) - echo "Determined binary version number 'v$VERSION'" # Determine remote URLs and SHA checksums - echo "Determining SHA checksums for remote files..." - URL_BIN=https://github.com/timvisee/ffsend/releases/download/v$VERSION/ffsend-v$VERSION-linux-x64-static - URL_SOURCE=https://gitlab.com/timvisee/ffsend/-/archive/v$VERSION/ffsend-v$VERSION.tar.gz - URL_BASH_COMPLETION=https://gitlab.com/timvisee/ffsend/raw/v$VERSION/contrib/completions/ffsend.bash - URL_ZSH_COMPLETION=https://gitlab.com/timvisee/ffsend/raw/v$VERSION/contrib/completions/_ffsend - URL_FISH_COMPLETION=https://gitlab.com/timvisee/ffsend/raw/v$VERSION/contrib/completions/ffsend.fish - URL_LICENSE=https://gitlab.com/timvisee/ffsend/raw/v$VERSION/LICENSE - 'echo "Selected binary URL: $URL_BIN"' - 'echo "Selected source URL: $URL_SOURCE"' - echo "Determining sha256sum for remote binary..." - 'SHA_BIN=$(curl -sSL "$URL_BIN" | sha256sum | cut -d" " -f1)' - 'echo "Got sha256sum: $SHA_BIN"' - 'SHA_BASH_COMPLETION=$(curl -sSL "$URL_BASH_COMPLETION" | sha256sum | cut -d" " -f1)' - 'echo "Got sha256sums of bash completion: $SHA_BASH_COMPLETION"' - 'SHA_ZSH_COMPLETION=$(curl -sSL "$URL_ZSH_COMPLETION" | sha256sum | cut -d" " -f1)' - 'echo "Got sha256sums of ZSH completion: $SHA_ZSH_COMPLETION"' - 'SHA_FISH_COMPLETION=$(curl -sSL "$URL_FISH_COMPLETION" | sha256sum | cut -d" " -f1)' - 'echo "Got sha256sums of fish completion: $SHA_FISH_COMPLETION"' - 'SHA_LICENSE=$(curl -sSL "$URL_LICENSE" | sha256sum | cut -d" " -f1)' - 'echo "Got sha256sums of LICENSE: $SHA_LICENSE"' - echo "Determining sha256sum for remote source..." - 'SHA_SOURCE=$(curl -sSL "$URL_SOURCE" | sha256sum | cut -d" " -f1)' - 'echo "Got sha256sum: $SHA_SOURCE"' # Update PKGBUILD parameters: version, source URL and SHA sum - echo "Updating PKGBUILDS with release information..." - sed "s/^pkgver=.*\$/pkgver=$VERSION/" -i ffsend/PKGBUILD - sed "s/^pkgver=.*\$/pkgver=$VERSION/" -i ffsend-bin/PKGBUILD - sed "s/^pkgver=.*\$/pkgver=$VERSION.$CI_COMMIT_SHORT_SHA/" -i ffsend-git/PKGBUILD - sed "s/^source=(\".*\").*\$/source=(\"$(echo $URL_SOURCE | sed 's/\//\\\//g')\")/" -i ffsend/PKGBUILD - sed "s/\(\"ffsend-v\$pkgver::\).*\"/\1$(echo $URL_BIN | sed 's/\//\\\//g')\"/" -i ffsend-bin/PKGBUILD - sed "s/\(\"ffsend-v\$pkgver.bash::\).*\"/\1$(echo $URL_BASH_COMPLETION | sed 's/\//\\\//g')\"/" -i ffsend-bin/PKGBUILD - sed "s/\(\"ffsend-v\$pkgver.zsh::\).*\"/\1$(echo $URL_ZSH_COMPLETION | sed 's/\//\\\//g')\"/" -i ffsend-bin/PKGBUILD - sed "s/\(\"ffsend-v\$pkgver.fish::\).*\"/\1$(echo $URL_FISH_COMPLETION | sed 's/\//\\\//g')\"/" -i ffsend-bin/PKGBUILD - sed "s/\(\"LICENSE-v\$pkgver::\).*\"/\1$(echo $URL_LICENSE | sed 's/\//\\\//g')\"/" -i ffsend-bin/PKGBUILD - sed "s/^sha256sums=.*\$/sha256sums=('$SHA_SOURCE')/" -i ffsend/PKGBUILD - sed "s/^sha256sums=.*\$/sha256sums=('$SHA_BIN' '$SHA_BASH_COMPLETION' '$SHA_ZSH_COMPLETION' '$SHA_FISH_COMPLETION' '$SHA_LICENSE')/" -i ffsend-bin/PKGBUILD # Get SHA hash for local and remote file w/o version, update if it has changed - 'SHA_STRIP_LOCAL=$(cat ffsend-git/PKGBUILD | sed /^pkgver=.\*/d | sha256sum | cut -d" " -f1)' - 'SHA_STRIP_REMOTE=$(curl -sSL "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=ffsend-git" | sed /^pkgver=.\*/d | sha256sum | cut -d" " -f1)' # Install dependencies - echo "Installing required build packages..." - pacman -Syu --noconfirm sudo base-devel binutils openssh rust cargo cmake git openssl # Make AUR package - mkdir -p /.cargo - chmod -R 777 /.cargo - cd ffsend-bin/ - echo "Making binary package..." - sudo -u nobody makepkg -c - sudo -u nobody makepkg --printsrcinfo > .SRCINFO - cd ../ffsend - echo "Making main source package..." - sudo -u nobody makepkg -c - sudo -u nobody makepkg --printsrcinfo > .SRCINFO # Make git package if different than the remote - | if [ ! "$SHA_STRIP_LOCAL" == "$SHA_STRIP_REMOTE" ]; then cd ../ffsend-git echo "Making git source package..." sudo -u nobody makepkg -c sudo -u nobody makepkg --printsrcinfo > .SRCINFO else echo "Not making git source package, it has not changed" fi - cd .. # Set up SSH for publishing - mkdir -p /root/.ssh - cp ./aur.pub /root/.ssh/id_rsa.pub - echo "$AUR_SSH_PRIVATE" > /root/.ssh/id_rsa - echo "Host aur.archlinux.org" >> /root/.ssh/config - echo " IdentityFile /root/.ssh/aur" >> /root/.ssh/config - echo " User aur" >> /root/.ssh/config - chmod 600 /root/.ssh/{id_rsa*,config} - eval `ssh-agent -s` - ssh-add /root/.ssh/id_rsa - ssh-keyscan -H aur.archlinux.org >> /root/.ssh/known_hosts - git config --global user.name "timvisee" - git config --global user.email "tim@visee.me" # Publish main package: clone AUR repo, commit update and push - git clone ssh://aur@aur.archlinux.org/ffsend.git aur-ffsend - cd aur-ffsend - cp ../ffsend/{PKGBUILD,.SRCINFO} ./ - git add PKGBUILD .SRCINFO - git commit -m "Release v$VERSION" - git push - cd .. # Publish binary package: clone AUR repo, commit update and push - git clone ssh://aur@aur.archlinux.org/ffsend-bin.git aur-ffsend-bin - cd aur-ffsend-bin - cp ../ffsend-bin/{PKGBUILD,.SRCINFO} ./ - git add PKGBUILD .SRCINFO - git commit -m "Release v$VERSION" - git push - cd .. # Publish git package: clone AUR repo, commit update and push # Only publish it if it is different than the remote - | if [ ! "$SHA_STRIP_LOCAL" == "$SHA_STRIP_REMOTE" ]; then git clone ssh://aur@aur.archlinux.org/ffsend-git.git aur-ffsend-git cd aur-ffsend-git cp ../ffsend-git/{PKGBUILD,.SRCINFO} ./ git add PKGBUILD .SRCINFO git commit -m "Update PKGBUILD for release v$VERSION" git push cd .. else echo "Not pushing git package, it has not changed" fi # TODO: add job to test ffsend{-git} AUR packages ================================================ FILE: .travis.yml ================================================ # Travis CI configuration for building macOS binaries for ffsend. # These macOS binaries are published on GitHub as release files. # # The main CI runs on GitLab CI at: https://gitlab.com/timvisee/ffsend/pipelines language: rust # Only build release jobs stages: - name: release if: tag =~ ^v(\d+\.)*\d+$ jobs: include: - stage: release rust: stable os: osx env: RUST_TARGET=x86_64-apple-darwin cache: cargo script: # Create release binary for macOS - echo "Creating release binary for $RUST_TARGET..." - cargo build --target=$RUST_TARGET --release --verbose --all - cp target/$RUST_TARGET/release/ffsend ./ffsend # Download github-release binary - wget https://github.com/tfausak/github-release/releases/download/1.2.4/github-release-osx.gz -O github-release.gz - gunzip github-release.gz - chmod a+x ./github-release # Create the release, upload binary - ./github-release release --token "$GITHUB_TOKEN" --owner timvisee --repo ffsend --tag "$TRAVIS_TAG" --title "ffsend $TRAVIS_TAG" - ./github-release upload --token "$GITHUB_TOKEN" --owner timvisee --repo ffsend --tag "$TRAVIS_TAG" --file ./ffsend --name ffsend-$TRAVIS_TAG-macos # TODO: disabled for now to throttle updates, manually enable on major release # # Update homebrew package # - git config --global user.name "timvisee" # - git config --global user.email "$GIT_EMAIL" # - git config --global credential.helper store # - echo "https://timvisee:$HOMEBREW_GITHUB_API_TOKEN@github.com" >> ~/.git-credentials # - brew bump-formula-pr --url="https://github.com/timvisee/ffsend/archive/$TRAVIS_TAG.tar.gz" --message="Automated release pull request using continuous integration." --no-browse -f -v ffsend ================================================ FILE: CONTRIBUTING.md ================================================ # Contributing **Repository:** - [GitLab repository][gitlab] - _Mirror: [GitHub repository][github]_ **Issues:** (bug reporting, feature requests, enhancements, etc.) - [GitLab issue board][gitlab-issues] - _Alternatively: [GitHub issue board][github-issues]_ **Pull/merge requests:** (fixes, implemented features, etc.) - [GitLab merge requests][gitlab-mr] - _Alternatively: [GitHub pull requests][github-pr]_ Contributions to the `ffsend` project are welcome! When contributing new features, alternative implementations or bigger improvements, please first discuss the change you wish to make via an issue or email. Small changes such as fixed commands, fixed spelling or dependency updates are always welcome without discussion. The `ffsend` repository is primarily hosted on [GitLab][gitlab]. [GitHub][github] hosts a mirror, for publicity and findability. Please open any issues or pull requests on the [GitLab][gitlab] pages if possible. Otherwise opening these on [GitHub][github] is fine, though they might be manually moved over to [GitLab][gitlab]. Please note we have a code of conduct, please follow it in all your interactions with the project. ## Pull Request Process 1. Ensure you've discussed your improvements in an issue when working on a bigger change 2. Ensure your branch is up-to-date with the latest [`master`][branch-master] 3. Ensure the project builds with your changes: `cargo build` 4. Ensure the project tests succeed with your changes: `cargo test` 5. Update the `README.md` with details of significant changes, this includes new compiler features, command-line arguments, environment variables or new package installation instructions. 6. Submit your pull request. 7. Fix any issues continuous integration might report. Additional notes: - Do not change version numbers, this is done by @timvisee ## Code of Conduct ### Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. ### Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ### Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ### Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ### Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project owner at 3a4fb3964f@sinenomine.email. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ### Attribution This Code of Conduct is adapted from the [Contributor Covenant][coc-homepage], version 1.4, available at [https://contributor-covenant.org/version/1/4][coc-version] ## License This project is released under the GNU GPL-3.0 license. Check out the [LICENSE](LICENSE) file for more information. [branch-master]: https://gitlab.com/timvisee/ffsend/tree/master [gitlab]: https://gitlab.com/timvisee/ffsend [gitlab-issues]: https://gitlab.com/timvisee/ffsend/issues [gitlab-mr]: https://gitlab.com/timvisee/ffsend/merge_requests [github]: https://github.com/timvisee/ffsend [github-issues]: https://github.com/timvisee/ffsend/issues [github-pr]: https://github.com/timvisee/ffsend/pulls [coc-homepage]: https://contributor-covenant.org [coc-version]: https://contributor-covenant.org/version/1/4/ ================================================ FILE: Cargo.toml ================================================ [package] name = "ffsend" version = "0.2.77" rust-version = "1.63.0" authors = ["Tim Visee <3a4fb3964f@sinenomine.email>"] license = "GPL-3.0" readme = "README.md" homepage = "https://timvisee.com/projects/ffsend" repository = "https://gitlab.com/timvisee/ffsend" description = """\ Easily and securely share files from the command line.\n\ A fully featured Send client.\ """ keywords = ["send", "firefox", "cli"] categories = [ "authentication", "command-line-interface", "command-line-utilities", "cryptography", "network-programming", ] exclude = [ "/.github", "/contrib", "/pkg", "/res", "/*.yml", "/CONTRIBUTING.md", "/SECURITY.md", ] edition = "2018" build = "build.rs" [package.metadata.deb] section = "utility" extended-description = """\ Easily and securely share files and directories from the command line through a safe, private and encrypted link using a single simple command. \ Files are shared using the Send service and may be up to 2GB. \ Others are able to download these files with this tool, \ or through their web browser.\n\ \n\ All files are always encrypted on the client, \ and secrets are never shared with the remote host. \ An optional password may be specified, and a default file lifetime of 1 \ (up to 20) download or 24 hours is enforced to ensure your stuff does not \ remain online forever. This provides a secure platform to share your files.""" priority = "standard" license-file = ["LICENSE", "3"] depends = "$auto, libssl1.1, ca-certificates, xclip" maintainer-scripts = "pkg/deb" [[bin]] name = "ffsend" path = "src/main.rs" [features] default = ["archive", "clipboard", "crypto-ring", "history", "infer-command", "qrcode", "send3", "urlshorten"] # Compile with file archiving support archive = ["tar"] # Support for putting share URLs in clipboard clipboard = ["clip", "which"] # Compile with file history support history = [] # Support for Send v2 send2 = ["ffsend-api/send2"] # Support for Send v3 send3 = ["ffsend-api/send3"] # Use OpenSSL as cryptography backend crypto-openssl = ["ffsend-api/crypto-openssl"] # Use ring as cryptography backend crypto-ring = ["ffsend-api/crypto-ring"] # Support for generating QR codes for share URLs qrcode = ["qr2term"] # Support for shortening share URLs urlshorten = ["urlshortener"] # Support for inferring subcommand when linking binary infer-command = [] # Compile without colored output support no-color = ["colored/no-color"] # Automatic using build.rs: use xclip/xsel binary method for clipboard support clipboard-bin = ["clipboard"] # Automatic using build.rs: use native clipboard crate for clipboard support clipboard-crate = ["clipboard"] [dependencies] chbs = "0.1.0" chrono = "0.4" clap = "2.33" colored = "2.0" derive_builder = "0.10" directories = "4.0" failure = "0.1" ffsend-api = { version = "0.7.3", default-features = false } fs2 = "0.4" lazy_static = "1.4" open = "2" openssl-probe = "0.1" pathdiff = "0.2" pbr = "1" prettytable-rs = { version = "0.10.0", default-features = false } qr2term = { version = "0.2", optional = true } rand = "0.8" regex = "1.5" rpassword = "5" serde = "1" serde_derive = "1" tar = { version = "0.4", optional = true } tempfile = "3" toml = "0.5" urlshortener = { version = "3", optional = true } version-compare = "0.1" [target.'cfg(any(target_os = "linux", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd"))'.dependencies] which = { version = "4.0", optional = true } [target.'cfg(not(any(target_os = "linux", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd")))'.dependencies] # Aliased to clip to prevent name collision with clipboard feature clip = { version = "0.5", optional = true, package = "clipboard" } [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] ================================================ FILE: LICENSE ================================================ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ================================================ FILE: README.md ================================================ [![Build status on GitLab CI][gitlab-ci-master-badge]][gitlab-ci-link] [![Newest release on crates.io][crate-version-badge]][crate-link] [![Project license][crate-license-badge]](LICENSE) [crate-license-badge]: https://img.shields.io/crates/l/ffsend.svg [crate-link]: https://crates.io/crates/ffsend [crate-version-badge]: https://img.shields.io/crates/v/ffsend.svg [gitlab-ci-link]: https://gitlab.com/timvisee/ffsend/pipelines [gitlab-ci-master-badge]: https://gitlab.com/timvisee/ffsend/badges/master/pipeline.svg *Notice: the default Send host is provided by [@timvisee][timvisee] ([info](https://gitlab.com/timvisee/ffsend/-/issues/111)). Please consider to [donate] and help keep it running.* # ffsend > Easily and securely share files from the command line. > A [Send][send] client. Easily and securely share files and directories from the command line through a safe, private and encrypted link using a single simple command. Files are shared using the [Send][send] service and may be up to 1GB. Others are able to download these files with this tool, or through their web browser. [![ffsend usage demo][usage-demo-svg]][usage-demo-asciinema] _No demo visible here? View it on [asciinema][usage-demo-asciinema]._ All files are always encrypted on the client, and secrets are never shared with the remote host. An optional password may be specified, and a default file lifetime of 1 (up to 20) download or 24 hours is enforced to ensure your stuff does not remain online forever. This provides a secure platform to share your files. Find out more about security [here](#security). - [Features](#features) - [Usage](#usage) - [Requirements](#requirements) - [Install](#install) ([Linux](#linux-all-distributions), [macOS](#macos), [Windows](#windows), [FreeBSD](#freebsd), [Android](#android), [_Other OS/architecture_](#other-os-or-architecture)) - [Build](#build) - [Configuration and environment](#configuration-and-environment) - [Security](#security) - [Help](#help) - [Special thanks](#special-thanks) - [License](#license) The public [Send][send] service that is used as default host is provided by [@timvisee][timvisee] ([info](https://gitlab.com/timvisee/ffsend/-/issues/111)). This application is not affiliated with [Firefox][firefox] or [Mozilla][mozilla] in any way. _Note: this tool is currently in beta, as some extra desired features are yet to be implemented_ ## Features - Fully featured and friendly command line tool - Upload and download files and directories securely, always encrypted on the client - Additional password protection, generation and configurable download limits - File and directory archiving and extraction - Built-in share URL shortener and QR code generator - Supports Send v3 (current) and v2 - History tracking your files for easy management - Ability to use your own Send hosts - Inspect or delete shared files - Accurate error reporting - Streaming encryption and uploading/downloading, very low memory footprint - Intended for use in [scripts](#scriptability) without interaction For a list of upcoming features and ideas, take a look at the current [open issues](https://gitlab.com/timvisee/ffsend/issues) over on GitLab. ## Usage Easily upload and download: ```bash # Simple upload $ ffsend upload my-file.txt https://send.vis.ee/#sample-share-url # Advanced upload # - Specify a download limit of 1 # - Specify upload expiry time of 5 minutes # - Enter a password to encrypt the file # - Archive the file before uploading # - Copy the shareable link to your clipboard # - Open the shareable link in your browser $ ffsend upload --downloads 1 --expiry-time 5m --password --archive --copy --open my-file.txt Password: ****** https://send.vis.ee/#sample-share-url # Upload to your own host $ ffsend u -h https://example.com/ my-file.txt https://example.com/#sample-share-url # Simple download $ ffsend download https://send.vis.ee/#sample-share-url ``` Inspect remote files: ```bash # Check if a file exists $ ffsend exists https://send.vis.ee/#sample-share-url Exists: yes # Fetch remote file info $ ffsend info https://send.vis.ee/#sample-share-url ID: b087066715 Name: my-file.txt Size: 12 KiB MIME: text/plain Downloads: 0 of 10 Expiry: 18h2m (64928s) ``` Other commands include: ```bash # View your file history $ ffsend history # LINK EXPIRE 1 https://send.vis.ee/#sample-share-url 23h57m 2 https://send.vis.ee/#other-sample-url 17h38m 3 https://example.com/#sample-share-url 37m30s # Change the password after uploading $ ffsend password https://send.vis.ee/#sample-share-url Password: ****** # Delete a file $ ffsend delete https://send.vis.ee/#sample-share-url ``` Use the `--help` flag, `help` subcommand, or see the [help](#help) section for all available subcommands. ## Requirements - Linux, macOS, Windows, FreeBSD, Android (other BSDs might work) - A terminal :sunglasses: - Internet connection - Linux: - OpenSSL & CA certificates: - Ubuntu, Debian and derivatives: `apt install openssl ca-certificates` - Optional: `xclip` or `xsel` for clipboard support - Ubuntu, Debian and derivatives: `apt install xclip` - CentOS/Red Hat/openSUSE/Fedora: `yum install xclip` - Arch: `pacman -S xclip` - Windows specific: - Optional OpenSSL with `crypto-openssl` feature: [» Installer][openssl-windows-installer] (`v1.1.0j` or above) - macOS specific: - Optional OpenSSL with `crypto-openssl` feature: `brew install openssl@1.1` - FreeBSD specific: - OpenSSL: `pkg install openssl` - CA certificates: `pkg install ca_root_nss` - Optional `xclip` & `xsel` for clipboard support: `pkg install xclip xsel-conrad` - Android specific: - Termux: [» Termux][termux] ## Install Because `ffsend` is still in early stages, only limited installation options are available right now. Feel free to contribute additional packages. Make sure you meet and install the [requirements](#requirements). See the operating system specific instructions below: - [Linux](#linux-all-distributions) - [macOS](#macos) - [Windows](#windows) - [FreeBSD](#freebsd) - [Android](#android) - [_Other OS or architecture_](#other-os-or-architecture) ### Linux (all distributions) Using the [snap](#linux-snap-package) package is recommended if supported. Alternatively you may install it manually using the [prebuilt binaries](#linux-prebuilt-binaries). Only 64-bit (`x86_64`) packages and binaries are provided. For other architectures and configurations you may [compile from source](#build). More packages options will be coming soon. #### Linux: snap package _Note: The `ffsend` `snap` package is isolated, and can only access files in your home directory. Choose a different installation option if you don't want this limitation._ _Note: due to how `snap` is configured by default, you won't be able to use the package from some contexts such as through SSH without manual modifications. If you're experiencing problems, please refer to a different installation method such as the [prebuilt binaries](#linux-prebuilt-binaries), or open an issue._ _Note: if you want to read/write to a flash drive run `snap connect ffsend:removable-media` [» `ffsend`][snapcraft-ffsend] ```bash snap install ffsend ffsend --help ``` #### Linux: Arch AUR packages [» `ffsend-bin`][aur-ffsend-bin] (precompiled binary, latest release, recommended) [» `ffsend`][aur-ffsend] (compiles from source, latest release) [» `ffsend-git`][aur-ffsend-git] (compiles from source, latest `master` commit) ```bash yay -S ffsend # or aurto add ffsend-bin sudo pacman -S ffsend-bin # or using any other AUR helper ffsend --help ``` #### Linux: Nix package _Note: The Nix package is currently not automatically updated, and might be slightly outdated._ [» ffsend][nix-ffsend] ```bash nix-channel --update nix-env --install ffsend ffsend --help ``` #### Linux: Fedora package _Note: The Fedora package is maintained by contributors, and might be slightly outdated._ [» ffsend][fedora-ffsend] ```bash sudo dnf install ffsend ffsend --help ``` #### Linux: Alpine package _Note: The Alpine package is maintained by contributors, it might be outdated. Choose a different installation method if an important update is missing._ [» ffsend][alpine-ffsend] ```bash apk add ffsend --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing ffsend --help ``` #### Linux: Prebuilt binaries Check out the [latest release][github-latest-release] assets for Linux binaries. Use the `ffsend-v*-linux-x64-static` binary, to minimize the chance for issues. If it isn't available yet, you may use an artifact from a [previous version][github-releases] instead, until it is available. Make sure you meet and install the [requirements](#requirements) before you continue. You must make the binary executable, and may want to move it into `/usr/bin` to make it easily executable: ```bash # Rename binary to ffsend mv ./ffsend-* ./ffsend # Mark binary as executable chmod a+x ./ffsend # Move binary into path, to make it easily usable sudo mv ./ffsend /usr/local/bin/ ffsend --help ``` ### macOS Using the [`homebrew` package](#macos-homebrew-package) is recommended. Alternatively you may install it via [MacPorts](#macos-macports), or manually using the [prebuilt binaries](#macos-prebuilt-binaries). #### macOS: homebrew package Make sure you've [`homebrew`][homebrew] installed, and run: ```bash brew install ffsend ffsend --help ``` #### macOS: MacPorts _Note: ffsend in MacPorts is currently not automatically updated, and might be slightly outdated._ Once you have [MacPorts](https://www.macports.org) installed, you can run: ```bash sudo port selfupdate sudo port install ffsend ``` #### macOS: Nix package _Note: The Nix package is currently not automatically updated, and might be slightly outdated._ ```bash nix-channel --update nix-env --install ffsend ffsend --help ``` #### macOS: Prebuilt binaries Check out the [latest release][github-latest-release] assets for a macOS binary. If it isn't available yet, you may use an artifact from a [previous version][github-releases] instead, until it is available. Then, mark the downloaded binary as an executable. You then may want to move it into `/usr/local/bin/` to make the `ffsend` command globally available: ```bash # Rename file to ffsend mv ./ffsend-* ./ffsend # Mark binary as executable chmod a+x ./ffsend # Move binary into path, to make it easily usable sudo mv ./ffsend /usr/local/bin/ ffsend ``` ### Windows Using the [`scoop` package](#windows-scoop-package) is recommended. Alternatively you may install it manually using the [prebuilt binaries](#windows-prebuilt-binaries). If you're using the [Windows Subsystem for Linux][wsl], it's highly recommended to install the [prebuilt Linux binary](#prebuilt-binaries-for-linux) instead. Only 64-bit (`x86_64`) binaries are provided. For other architectures and configurations you may [compile from source](#build). A `chocolatey` package along with an `.msi` installer will be coming soon. #### Windows: scoop package Make sure you've [`scoop`][scoop-install] installed, and run: ```bash scoop install ffsend ffsend --help ``` #### Windows: Prebuilt binaries Check out the [latest release][github-latest-release] assets for Windows binaries. Use the `ffsend-v*-windows-x64-static` binary, to minimize the chance for issues. If it isn't available yet, you may use an artifact from a [previous version][github-releases] instead, until it is available. You can use `ffsend` from the command line in the same directory: ```cmd .\ffsend.exe --help ``` To make it globally invocable as `ffsend`, you must make the binary available in your systems `PATH`. The easiest solution is to move it into `System32`: ```cmd move .\ffsend.exe C:\Windows\System32\ffsend.exe ``` ### FreeBSD [» `ffsend`][freshports-ffsend] _Note: The FreeBSD package is currently maintained by FreeBSD contributors, and might be slightly outdated._ ```sh # Precompiled binary. pkg install ffsend # Compiles and installs from source. cd /usr/ports/www/ffsend && make install ``` ### Android `ffsend` can be used on Android through Termux, install it first: [» Termux][termux] _Note: The Android package is currently maintained by Termux contributors, and might be slightly outdated._ ```sh # Install package. pkg install ffsend ffsend help ``` ### Other OS or architecture If your system runs Docker, you can use the [docker image](#docker-image). There are currently no other binaries or packages available. You can [build the project from source](#build) instead. #### Docker image A Docker image is available for using `ffsend` running in a container. Mount a directory to `/data`, so it's accessible for `ffsend` in the container, and use the command as you normally would. [» `timvisee/ffsend`][docker-hub-ffsend] ```bash # Invoke without arguments docker run --rm -it -v $(pwd):/data timvisee/ffsend # Upload my-file.txt docker run --rm -it -v $(pwd):/data timvisee/ffsend upload my-file.txt # Download from specified link docker run --rm -it -v $(pwd):/data timvisee/ffsend download https://send.vis.ee/#sample-share-url # Show help docker run --rm -it -v $(pwd):/data timvisee/ffsend help # To update the used image docker pull timvisee/ffsend ``` On Linux or macOS you might define a alias in your shell configuration, to make it invocable as `ffsend`: ```bash alias ffsend='docker run --rm -it -v "$(pwd):/data" timvisee/ffsend' ``` _Note: This implementation is limited to accessing the paths you make available through the specified mount._ ## Build To build and install `ffsend` yourself, you meet the following requirements before proceeding: ### Build requirements - Runtime [requirements](#requirements) - [`git`][git] - [`rust`][rust] `v1.63` (MSRV) or higher (install using [`rustup`][rustup]) - [OpenSSL][openssl] or [LibreSSL][libressl] libraries/headers: - Linux: - Ubuntu, Debian and derivatives: `apt install build-essential cmake pkg-config libssl-dev` - CentOS/Red Hat/openSUSE: `yum install gcc gcc-c++ make cmake openssl-devel` - Arch: `pacman -S openssl base-devel` - Gentoo: `emerge -a dev-util/pkgconfig dev-util/cmake dev-libs/openssl` - Fedora: `dnf install gcc gcc-c++ make cmake openssl-devel` - Or see instructions [here](https://github.com/sfackler/rust-openssl#linux) - Windows: - Optional with `crypto-openssl` feature: See instructions here [here](https://github.com/sfackler/rust-openssl#windows-msvc) - macOS: - Optional with `crypto-openssl` feature: `brew install cmake pkg-config openssl` or see instructions [here](https://github.com/sfackler/rust-openssl#osx) - FreeBSD: - `pkg install rust gmake pkgconf python36 libxcb xclip ca_root_nss xsel-conrad` - It is a better idea to use & modify the existing `ffsend` port, which manages dependencies for you. ### Compile and install Then, walk through one of the following steps to compile and install `ffsend`: - Compile and install it directly from cargo: ```bash # Compile and install from cargo cargo install ffsend -f # Start using ffsend ffsend --help ``` - Or clone the repository and install it with `cargo`: ```bash # Clone the project git clone https://github.com/timvisee/ffsend.git cd ffsend # Compile and install cargo install --path . -f # Start using ffsend ffsend --help # or run it directly from cargo cargo run --release -- --help ``` - Or clone the repository and invoke the binary directly (Linux/macOS): ```bash # Clone the project git clone https://github.com/timvisee/ffsend.git cd ffsend # Build the project (release version) cargo build --release # Start using ffsend ./target/release/ffsend --help ``` ### Compile features / use flags Different use flags are available for `ffsend` to toggle whether to include various features. The following features are available, some of which are enabled by default: | Feature | Enabled | Description | | :-------------: | :-----: | :--------------------------------------------------------- | | `send2` | Default | Support for Send v2 servers | | `send3` | Default | Support for Send v3 servers | | `crypto-ring` | Default | Use ring as cryptography backend | | `crypto-openssl`| | Use OpenSSL as cryptography backend | | `clipboard` | Default | Support for copying links to the clipboard | | `history` | Default | Support for tracking files in history | | `archive` | Default | Support for archiving and extracting uploads and downloads | | `qrcode` | Default | Support for rendering a QR code for a share URL | | `urlshorten` | Default | Support for shortening share URLs | | `infer-command` | Default | Support for inferring subcommand based on binary name | | `no-color` | | Compile without color support in error and help messages | To enable features during building or installation, specify them with `--features ` when using `cargo`. You may want to disable default features first using `--no-default-features`. Here are some examples: ```bash # Defaults set of features with no-color, one of cargo install --features no-color cargo build --release --features no-color # No default features, except required cargo install --no-default-features --features send3,crypto-ring # With history and clipboard support cargo install --no-default--features --features send3,crypto-ring,history,clipboard ``` For Windows systems it is recommended to provide the `no-color` flag, as color support in Windows terminals is flaky. ## Configuration and environment The following environment variables may be used to configure the following defaults. The CLI flag is shown along with it, to better describe the relation to command line arguments: | Variable | CLI flag | Description | | :------------------------ | :----------------------------: | :-------------------------------------------- | | `FFSEND_HISTORY` | `--history ` | History file path | | `FFSEND_HOST` | `--host ` | Upload host | | `FFSEND_TIMEOUT` | `--timeout ` | Request timeout (0 to disable) | | `FFSEND_TRANSFER_TIMEOUT` | `--transfer-timeout ` | Transfer timeout (0 to disable) | | `FFSEND_EXPIRY_TIME` | `--expiry-time ` | Default upload expiry time | | `FFSEND_DOWNLOAD_LIMIT` | `--download-limit ` | Default download limit | | `FFSEND_API` | `--api ` | Server API version, `-` to lookup | | `FFSEND_BASIC_AUTH` | `--basic-auth ` | Basic HTTP authentication credentials to use. | These environment variables may be used to toggle a flag, simply by making them available. The actual value of these variables is ignored, and variables may be empty. | Variable | CLI flag | Description | | :------------------- | :-------------: | :--------------------------------- | | `FFSEND_FORCE` | `--force` | Force operations | | `FFSEND_NO_INTERACT` | `--no-interact` | No interaction for prompts | | `FFSEND_YES` | `--yes` | Assume yes for prompts | | `FFSEND_INCOGNITO` | `--incognito` | Incognito mode, don't use history | | `FFSEND_OPEN` | `--open` | Open share link of uploaded file | | `FFSEND_ARCHIVE` | `--archive` | Archive files uploaded | | `FFSEND_EXTRACT` | `--extract` | Extract files downloaded | | `FFSEND_COPY` | `--copy` | Copy share link to clipboard | | `FFSEND_COPY_CMD` | `--copy-cmd` | Copy download command to clipboard | | `FFSEND_QUIET` | `--quiet` | Log quiet information | | `FFSEND_VERBOSE` | `--verbose` | Log verbose information | Some environment variables may be set at compile time to tweak some defaults. | Variable | Description | | :----------- | :------------------------------------------------------------------------- | | `XCLIP_PATH` | Set fixed `xclip` binary path when using `clipboard-bin` (Linux, *BSD) | | `XSEL_PATH` | Set fixed `xsel` binary path when using `clipboard-bin` (Linux, *BSD) | At this time, no configuration or _dotfile_ file support is available. This will be something added in a later release. ### Binary for each subcommand: `ffput`, `ffget` `ffsend` supports having a separate binaries for single subcommands, such as having `ffput` and `ffget` just for to upload and download using `ffsend`. This allows simple and direct commands like: ```bash ffput my-file.txt ffget https://send.vis.ee/#sample-share-url ``` This works for a predefined list of binary names: - `ffput` → `ffsend upload ...` - `ffget` → `ffsend download ...` - `ffdel` → `ffsend delete ...` - _This list is defined in [`src/config.rs`](./src/config.rs) as `INFER_COMMANDS`_ You can use the following methods to set up these single-command binaries: - Create a properly named symbolic link (recommended) - Create a properly named hard link - Clone the `ffsend` binary, and rename it On Linux and macOS you can use the following command to set up symbolic links in the current directory: ```bash ln -s $(which ffsend) ./ffput ln -s $(which ffsend) ./ffget ``` Support for this feature is only available when `ffsend` is compiled with the [`infer-command`](#compile-features--use-flags) feature flag. This is usually enabled by default. To verify support is available with an existing installation, make sure the feature is listed when invoking `ffsend debug`. Note that the `snap` package does currently not support this due to how this package format works. ### Scriptability `ffsend` is optimized for use in automated scripts. It provides some specialized arguments to control `ffsend` without user interaction. - `--no-interact` (`-I`): do not allow user interaction. For prompts not having a default value, the application will quit with an error, unless `--yes` or `--force` is provided. This should **always** be given when using automated scripting. Example: when uploading a directory, providing this flag will stop the archive question prompt form popping up, and will archive the directory as default option. - `--yes` (`-y`): assume the yes option for yes/no prompt by default. Example: when downloading a file that already exists, providing this flag will assume yes when asking to overwrite a file. - `--force` (`-f`): force to continue with the action, skips any warnings that would otherwise quit the application. Example: when uploading a file that is too big, providing this flag will ignore the file size warning and forcefully continues. - `--quiet` (`-q`): be quiet, print as little information as possible. Example: when uploading a file, providing this flag will only output the final share URL. Generally speaking, use the following rules when automating: - Always provide `--no-interact` (`-I`). - Provide any combination of `--yes` (`-y`) and `--force` (`-f`) for actions you want to complete no matter what. - When passing share URLs along, provide the `--quiet` (`-q`) flag, when uploading for example. These flags can also automatically be set by defining environment variables as specified here: [» Configuration and environment](#configuration-and-environment) Here are some examples commands in `bash`: ```bash # Stop on error set -e # Upload a file # -I: no interaction # -y: assume yes # -q: quiet output, just return the share link URL=$(ffsend -Iy upload -q my-file.txt) # Render file information # -I: no interaction # -f: force, just show the info ffsend -If info $URL # Set a password for the uploaded file ffsend -I password $URL --password="secret" # Use the following flags automatically from now on # -I: no interaction # -f: force # -y: yes export FFSEND_NO_INTERACT=1 FFSEND_FORCE=1 FFSEND_YES=1 # Download the uploaded file, overwriting the local variant due to variables ffsend download $URL --password="secret" ``` For more information on these arguments, invoke `ffsend help` and check out: [» Configuration and environment](#configuration-and-environment) For other questions regarding automation or feature requests, be sure to [open](https://github.com/timvisee/ffsend/issues/) an issue. ## Security In short; the `ffsend` tool and the [Send][send] service can be considered secure, and may be used to share sensitive files. Note though that the created share link for an upload will allow anyone to download the file. Make sure you don't share this link with unauthorized people. For more detailed information on encryption, please read the rest of the paragraphs in this security section. _Note: even though the encryption method is considered secure, this `ffsend` tool does not provide any warranty in any way, shape or form for files that somehow got decrypted without proper authorization._ #### Client side encryption `ffsend` uses client side encryption, to ensure your files are securely encrypted before they are uploaded to the remote host. This makes it impossible for third parties to decrypt your file without having the secret (encryption key). The file and its metadata are encrypted using `128-bit AES-GCM`, and a `HMAC SHA-256` signing key is used for request authentication. This is consistent with the encryption documentation provided by the [Send][send] service, `ffsend` is a tool for. A detailed list on the encryption/decryption steps, and on what encryption is exactly used can be found [here][send-encryption] in the official service documentation. #### Note on share link security The encryption secret, that is used to decrypt the file when downloading, is included in the share URL behind the `#` (hash). This secret is never sent the remote server directly when using the share link in your browser. It would be possible however for a webpage to load some malicious JavaScript snippet that eventually steals the secret from the link once the page is loaded. Although this scenario is extremely unlikely, there are some options to prevent this from happening: - Only use this `ffsend` tool, do not use the share link in your browser. - Add additional protection by specifying a password using `--password` while uploading, or using the `password` subcommand afterwards. - Host a secure [Send][send] service instance yourself. A complete overview on encryption can be found in the official service documentation [here][send-encryption]. ## Help ``` $ ffsend help ffsend 0.2.72 Tim Visee <3a4fb3964f@sinenomine.email> Easily and securely share files from the command line. A fully featured Send client. The default public Send host is provided by Tim Visee, @timvisee. Please consider to donate and help keep it running: https://vis.ee/donate USAGE: ffsend [FLAGS] [OPTIONS] [SUBCOMMAND] FLAGS: -f, --force Force the action, ignore warnings -h, --help Prints help information -i, --incognito Don't update local history for actions -I, --no-interact Not interactive, do not prompt -q, --quiet Produce output suitable for logging and automation -V, --version Prints version information -v, --verbose Enable verbose information and logging -y, --yes Assume yes for prompts OPTIONS: -A, --api Server API version to use, '-' to lookup [env: FFSEND_API] --basic-auth Protected proxy HTTP basic authentication credentials (not FxA) [env: FFSEND_BASIC_AUTH] -H, --history Use the specified history file [env: FFSEND_HISTORY] -t, --timeout Request timeout (0 to disable) [env: FFSEND_TIMEOUT] -T, --transfer-timeout Transfer timeout (0 to disable) [env: FFSEND_TRANSFER_TIMEOUT] SUBCOMMANDS: upload Upload files [aliases: u, up] download Download files [aliases: d, down] debug View debug information [aliases: dbg] delete Delete a shared file [aliases: del, rm] exists Check whether a remote file exists [aliases: e] generate Generate assets [aliases: gen] help Prints this message or the help of the given subcommand(s) history View file history [aliases: h] info Fetch info about a shared file [aliases: i] parameters Change parameters of a shared file [aliases: params] password Change the password of a shared file [aliases: pass, p] version Determine the Send server version [aliases: v] This application is not affiliated with Firefox or Mozilla. ``` ## Special thanks - to all `ffsend` source/package contributors - to [Mozilla][mozilla] for building the amazing [Firefox Send][mozilla-send] service ([fork][timvisee-send]) - to everyone involved with [asciinema][asciinema] and [svg-term][svg-term] for providing tools to make great visual demos - to everyone involved in all crate dependencies used ## License This project is released under the GNU GPL-3.0 license. Check out the [LICENSE](LICENSE) file for more information. [usage-demo-asciinema]: https://asciinema.org/a/182225 [usage-demo-svg]: https://cdn.rawgit.com/timvisee/ffsend/6e8ef55b/res/demo.svg [firefox]: https://firefox.com/ [git]: https://git-scm.com/ [libressl]: https://libressl.org/ [mozilla]: https://mozilla.org/ [openssl]: https://www.openssl.org/ [openssl-windows-installer]: https://u.visee.me/dl/openssl/Win64OpenSSL_Light-1_1_0j.exe [termux]: https://termux.com/ [rust]: https://rust-lang.org/ [rustup]: https://rustup.rs/ [send]: https://github.com/timvisee/send [mozilla-send]: https://github.com/mozilla/send [timvisee-send]: https://github.com/timvisee/send [send-encryption]: https://github.com/timvisee/send/blob/master/docs/encryption.md [asciinema]: https://asciinema.org/ [svg-term]: https://github.com/marionebl/svg-term-cli [github-releases]: https://github.com/timvisee/ffsend/releases [github-latest-release]: https://github.com/timvisee/ffsend/releases/latest [nix-ffsend]: https://nixos.org/nixos/packages.html?attr=ffsend&channel=nixos-unstable&query=ffsend [fedora-ffsend]: https://src.fedoraproject.org/rpms/rust-ffsend [aur-ffsend]: https://aur.archlinux.org/packages/ffsend/ [aur-ffsend-bin]: https://aur.archlinux.org/packages/ffsend-bin/ [aur-ffsend-git]: https://aur.archlinux.org/packages/ffsend-git/ [alpine-ffsend]: https://pkgs.alpinelinux.org/packages?name=ffsend&branch=edge [snapcraft-ffsend]: https://snapcraft.io/ffsend [homebrew]: https://brew.sh/ [wsl]: https://docs.microsoft.com/en-us/windows/wsl/install-win10 [docker-hub-ffsend]: https://hub.docker.com/r/timvisee/ffsend [scoop-install]: https://scoop.sh/#installs-in-seconds [freshports-ffsend]: https://www.freshports.org/www/ffsend [timvisee]: https://timvisee.com/ [donate]: https://timvisee.com/donate ================================================ FILE: SECURITY.md ================================================ # Security Policy ## Supported Versions | Version | Supported | | ------- | ------------------ | | 0.2.x | :white_check_mark: | ## Reporting a Vulnerability To report a vulnerability in this project, or in one if it's dependency; please [open](https://gitlab.com/timvisee/ffsend/issues/new) a new issue on GitLab (or on [GitHub](https://github.com/timvisee/ffsend/issues/new)) describing the situation. For confidential issues, you may send an email to the main developer (@timvisee) at: `3a4fb3964f@sinenomine.email` Or see other methods of contacting over on: [timvisee.com/contact](https://timvisee.com/contact) To contribute code for fixing a vulnerability, please refer to the [contribution](./CONTRIBUTING.md) document. ================================================ FILE: appveyor.yml ================================================ # AppVeyor CI configuration for building Windows binaries for ffsend. # These Windows binaries are published on GitHub as release files. # # The main CI runs on GitLab CI at: https://gitlab.com/timvisee/ffsend/pipelines # Only build version tags skip_non_tags: true branches: only: - /v\d*\.\d*\.\d*/ # Build for the x86_64 Windows target platform: x64 environment: RUSTUP_USE_HYPER: 1 CARGO_HTTP_CHECK_REVOKE: false GITHUB_TOKEN: secure: jqZ4q5oOthKX/pBL1tRsBJsfGPIee3q+N/UBSCZNjCrlFUNfQSfibBPzzICYg1he CHOCOLATEY_TOKEN: secure: k5Q57xoXa6qSFScSpRaww2puW0yjYoH19uIq3qS1emOG+lNs9TYCnWYhUzQ2gzfc matrix: - TARGET: x86_64-pc-windows-msvc BITS: 64 # Extract release binary artifacts artifacts: - path: .\ffsend*.exe - path: .\ffsend.*.nupkg # Install dependencies: Rust install: # Install Rust - appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe - rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain stable - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin - rustc -V - cargo -V - git submodule update --init # Build dynamic and static Windows binaries, release on GitHub build_script: # Build dynamic release binary - cargo build --release --features no-color --verbose - copy .\target\release\ffsend.exe .\ffsend-%TARGET%.exe # Build static release binary - set RUSTFLAGS=-Ctarget-feature=+crt-static - cargo build --release --features no-color --verbose - copy .\target\release\ffsend.exe .\ffsend-%TARGET%-static.exe # Install github-release - appveyor DownloadFile https://github.com/tfausak/github-release/releases/download/1.2.4/github-release-windows.zip -FileName github-release.zip - 7z e github-release.zip # Collect binary, set package version and build chocolatey package - copy .\ffsend-%TARGET%-static.exe .\pkg\choco\ffsend\tools\ffsend.exe - cd .\pkg\choco\ffsend\ - ps: echo $env:APPVEYOR_REPO_TAG_NAME - ps: ((Get-Content -path .\ffsend.nuspec -Raw) -replace "0.0.0",$env:APPVEYOR_REPO_TAG_NAME.Substring(1)) | Set-Content -Path .\ffsend.nuspec - choco pack - copy ffsend.*.nupkg ..\..\..\ - cd ..\..\..\ # Create the release, upload the binaries # TODO: fix the line below, which is causing CI to error # - ps: Invoke-Expression -Command '$ErrorActionPreference = "SilentlyContinue"; .\github-release.exe release --token $env:GITHUB_TOKEN --owner timvisee --repo ffsend --tag $env:APPVEYOR_REPO_TAG_NAME --title "ffsend $env:APPVEYOR_REPO_TAG_NAME"; exit 0' - ps: .\github-release.exe upload --token $env:GITHUB_TOKEN --owner timvisee --repo ffsend --tag $env:APPVEYOR_REPO_TAG_NAME --file .\ffsend-$env:TARGET.exe --name ffsend-$env:APPVEYOR_REPO_TAG_NAME-windows-x64.exe - ps: .\github-release.exe upload --token $env:GITHUB_TOKEN --owner timvisee --repo ffsend --tag $env:APPVEYOR_REPO_TAG_NAME --file .\ffsend-$env:TARGET-static.exe --name ffsend-$env:APPVEYOR_REPO_TAG_NAME-windows-x64-static.exe - ps: .\github-release.exe upload --token $env:GITHUB_TOKEN --owner timvisee --repo ffsend --tag $env:APPVEYOR_REPO_TAG_NAME --file (Get-Item .\ffsend.*.nupkg).FullName --name ffsend-$env:APPVEYOR_REPO_TAG_NAME.nupkg # Publish the chocolatey package # TODO: re-enable when chocolatey is properly accepting packages again # - cd .\pkg\choco\ffsend\ # - choco push --api-key %CHOCOLATEY_TOKEN% # - cd ..\..\..\ # We don't test anything here test: false ================================================ FILE: build.rs ================================================ fn main() { #[cfg(all( feature = "clipboard", any( target_os = "linux", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd", ) ))] { // Select clipboard binary method #[cfg(not(feature = "clipboard-crate"))] println!("cargo:rustc-cfg=feature=\"clipboard-bin\""); // xclip and xsel paths are inserted at compile time println!("cargo:rerun-if-env-changed=XCLIP_PATH"); println!("cargo:rerun-if-env-changed=XSEL_PATH"); } #[cfg(all( feature = "clipboard", not(any( target_os = "linux", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd", )) ))] { // Select clipboard crate method #[cfg(not(feature = "clipboard-bin"))] println!("cargo:rustc-cfg=feature=\"clipboard-crate\""); } } ================================================ FILE: contrib/completions/_ffsend ================================================ #compdef ffsend autoload -U is-at-least _ffsend() { typeset -A opt_args typeset -a _arguments_options local ret=1 if is-at-least 5.2; then _arguments_options=(-s -S -C) else _arguments_options=(-s -C) fi local context curcontext="$curcontext" state line _arguments "${_arguments_options[@]}" \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ ":: :_ffsend_commands" \ "*::: :->ffsend" \ && ret=0 case $state in (ffsend) words=($line[1] "${words[@]}") (( CURRENT += 1 )) curcontext="${curcontext%:*:*}:ffsend-command-$line[1]:" case $line[1] in (dbg) _arguments "${_arguments_options[@]}" \ '-h+[The remote host to upload to]' \ '--host=[The remote host to upload to]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ && ret=0 ;; (debug) _arguments "${_arguments_options[@]}" \ '-h+[The remote host to upload to]' \ '--host=[The remote host to upload to]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ && ret=0 ;; (del) _arguments "${_arguments_options[@]}" \ '-o+[Specify the file owner token]' \ '--owner=[Specify the file owner token]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':URL -- The share URL:_files' \ && ret=0 ;; (rm) _arguments "${_arguments_options[@]}" \ '-o+[Specify the file owner token]' \ '--owner=[Specify the file owner token]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':URL -- The share URL:_files' \ && ret=0 ;; (delete) _arguments "${_arguments_options[@]}" \ '-o+[Specify the file owner token]' \ '--owner=[Specify the file owner token]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':URL -- The share URL:_files' \ && ret=0 ;; (d) _arguments "${_arguments_options[@]}" \ '-p+[Unlock a password protected file]' \ '--password=[Unlock a password protected file]' \ '-o+[Output file or directory]' \ '--output=[Output file or directory]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-e[Extract an archived file]' \ '--extract[Extract an archived file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':URL -- The share URL:_files' \ && ret=0 ;; (down) _arguments "${_arguments_options[@]}" \ '-p+[Unlock a password protected file]' \ '--password=[Unlock a password protected file]' \ '-o+[Output file or directory]' \ '--output=[Output file or directory]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-e[Extract an archived file]' \ '--extract[Extract an archived file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':URL -- The share URL:_files' \ && ret=0 ;; (download) _arguments "${_arguments_options[@]}" \ '-p+[Unlock a password protected file]' \ '--password=[Unlock a password protected file]' \ '-o+[Output file or directory]' \ '--output=[Output file or directory]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-e[Extract an archived file]' \ '--extract[Extract an archived file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':URL -- The share URL:_files' \ && ret=0 ;; (e) _arguments "${_arguments_options[@]}" \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':URL -- The share URL:_files' \ && ret=0 ;; (exist) _arguments "${_arguments_options[@]}" \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':URL -- The share URL:_files' \ && ret=0 ;; (exists) _arguments "${_arguments_options[@]}" \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':URL -- The share URL:_files' \ && ret=0 ;; (gen) _arguments "${_arguments_options[@]}" \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ":: :_ffsend__generate_commands" \ "*::: :->generate" \ && ret=0 case $state in (generate) words=($line[1] "${words[@]}") (( CURRENT += 1 )) curcontext="${curcontext%:*:*}:ffsend-generate-command-$line[1]:" case $line[1] in (completion) _arguments "${_arguments_options[@]}" \ '-o+[Shell completion files output directory]' \ '--output=[Shell completion files output directory]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':SHELL -- Shell type to generate completions for:(all zsh bash fish powershell elvish)' \ && ret=0 ;; (complete) _arguments "${_arguments_options[@]}" \ '-o+[Shell completion files output directory]' \ '--output=[Shell completion files output directory]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':SHELL -- Shell type to generate completions for:(all zsh bash fish powershell elvish)' \ && ret=0 ;; (completions) _arguments "${_arguments_options[@]}" \ '-o+[Shell completion files output directory]' \ '--output=[Shell completion files output directory]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':SHELL -- Shell type to generate completions for:(all zsh bash fish powershell elvish)' \ && ret=0 ;; (help) _arguments "${_arguments_options[@]}" \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ && ret=0 ;; esac ;; esac ;; (generate) _arguments "${_arguments_options[@]}" \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ":: :_ffsend__generate_commands" \ "*::: :->generate" \ && ret=0 case $state in (generate) words=($line[1] "${words[@]}") (( CURRENT += 1 )) curcontext="${curcontext%:*:*}:ffsend-generate-command-$line[1]:" case $line[1] in (completion) _arguments "${_arguments_options[@]}" \ '-o+[Shell completion files output directory]' \ '--output=[Shell completion files output directory]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':SHELL -- Shell type to generate completions for:(all zsh bash fish powershell elvish)' \ && ret=0 ;; (complete) _arguments "${_arguments_options[@]}" \ '-o+[Shell completion files output directory]' \ '--output=[Shell completion files output directory]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':SHELL -- Shell type to generate completions for:(all zsh bash fish powershell elvish)' \ && ret=0 ;; (completions) _arguments "${_arguments_options[@]}" \ '-o+[Shell completion files output directory]' \ '--output=[Shell completion files output directory]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':SHELL -- Shell type to generate completions for:(all zsh bash fish powershell elvish)' \ && ret=0 ;; (help) _arguments "${_arguments_options[@]}" \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ && ret=0 ;; esac ;; esac ;; (i) _arguments "${_arguments_options[@]}" \ '-o+[Specify the file owner token]' \ '--owner=[Specify the file owner token]' \ '-p+[Unlock a password protected file]' \ '--password=[Unlock a password protected file]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':URL -- The share URL:_files' \ && ret=0 ;; (information) _arguments "${_arguments_options[@]}" \ '-o+[Specify the file owner token]' \ '--owner=[Specify the file owner token]' \ '-p+[Unlock a password protected file]' \ '--password=[Unlock a password protected file]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':URL -- The share URL:_files' \ && ret=0 ;; (info) _arguments "${_arguments_options[@]}" \ '-o+[Specify the file owner token]' \ '--owner=[Specify the file owner token]' \ '-p+[Unlock a password protected file]' \ '--password=[Unlock a password protected file]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':URL -- The share URL:_files' \ && ret=0 ;; (params) _arguments "${_arguments_options[@]}" \ '-o+[Specify the file owner token]' \ '--owner=[Specify the file owner token]' \ '-d+[The file download limit]' \ '--download-limit=[The file download limit]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':URL -- The share URL:_files' \ && ret=0 ;; (param) _arguments "${_arguments_options[@]}" \ '-o+[Specify the file owner token]' \ '--owner=[Specify the file owner token]' \ '-d+[The file download limit]' \ '--download-limit=[The file download limit]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':URL -- The share URL:_files' \ && ret=0 ;; (parameter) _arguments "${_arguments_options[@]}" \ '-o+[Specify the file owner token]' \ '--owner=[Specify the file owner token]' \ '-d+[The file download limit]' \ '--download-limit=[The file download limit]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':URL -- The share URL:_files' \ && ret=0 ;; (parameters) _arguments "${_arguments_options[@]}" \ '-o+[Specify the file owner token]' \ '--owner=[Specify the file owner token]' \ '-d+[The file download limit]' \ '--download-limit=[The file download limit]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':URL -- The share URL:_files' \ && ret=0 ;; (pass) _arguments "${_arguments_options[@]}" \ '-p+[Specify a password, do not prompt]' \ '--password=[Specify a password, do not prompt]' \ '-o+[Specify the file owner token]' \ '--owner=[Specify the file owner token]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '(-p --password)-P[Protect the file with a generated passphrase]' \ '(-p --password)--gen-passphrase[Protect the file with a generated passphrase]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':URL -- The share URL:_files' \ && ret=0 ;; (p) _arguments "${_arguments_options[@]}" \ '-p+[Specify a password, do not prompt]' \ '--password=[Specify a password, do not prompt]' \ '-o+[Specify the file owner token]' \ '--owner=[Specify the file owner token]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '(-p --password)-P[Protect the file with a generated passphrase]' \ '(-p --password)--gen-passphrase[Protect the file with a generated passphrase]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':URL -- The share URL:_files' \ && ret=0 ;; (password) _arguments "${_arguments_options[@]}" \ '-p+[Specify a password, do not prompt]' \ '--password=[Specify a password, do not prompt]' \ '-o+[Specify the file owner token]' \ '--owner=[Specify the file owner token]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '(-p --password)-P[Protect the file with a generated passphrase]' \ '(-p --password)--gen-passphrase[Protect the file with a generated passphrase]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':URL -- The share URL:_files' \ && ret=0 ;; (u) _arguments "${_arguments_options[@]}" \ '-p+[Protect the file with a password]' \ '--password=[Protect the file with a password]' \ '-d+[The file download limit]' \ '--download-limit=[The file download limit]' \ '-e+[The file expiry time]' \ '--expiry-time=[The file expiry time]' \ '-h+[The remote host to upload to]' \ '--host=[The remote host to upload to]' \ '-n+[Rename the file being uploaded]' \ '--name=[Rename the file being uploaded]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '(-p --password)-P[Protect the file with a generated passphrase]' \ '(-p --password)--gen-passphrase[Protect the file with a generated passphrase]' \ '-o[Open the share link in your browser]' \ '--open[Open the share link in your browser]' \ '-D[Delete local file after upload]' \ '--delete[Delete local file after upload]' \ '-a[Archive the upload in a single file]' \ '--archive[Archive the upload in a single file]' \ '(-C --copy-cmd)-c[Copy the share link to your clipboard]' \ '(-C --copy-cmd)--copy[Copy the share link to your clipboard]' \ '(-c --copy)-C[Copy the ffsend download command to your clipboard]' \ '(-c --copy)--copy-cmd[Copy the ffsend download command to your clipboard]' \ '-S[Shorten share URLs with a public service]' \ '--shorten[Shorten share URLs with a public service]' \ '-Q[Print a QR code for the share URL]' \ '--qrcode[Print a QR code for the share URL]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':FILE -- The file(s) to upload:_files' \ && ret=0 ;; (up) _arguments "${_arguments_options[@]}" \ '-p+[Protect the file with a password]' \ '--password=[Protect the file with a password]' \ '-d+[The file download limit]' \ '--download-limit=[The file download limit]' \ '-e+[The file expiry time]' \ '--expiry-time=[The file expiry time]' \ '-h+[The remote host to upload to]' \ '--host=[The remote host to upload to]' \ '-n+[Rename the file being uploaded]' \ '--name=[Rename the file being uploaded]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '(-p --password)-P[Protect the file with a generated passphrase]' \ '(-p --password)--gen-passphrase[Protect the file with a generated passphrase]' \ '-o[Open the share link in your browser]' \ '--open[Open the share link in your browser]' \ '-D[Delete local file after upload]' \ '--delete[Delete local file after upload]' \ '-a[Archive the upload in a single file]' \ '--archive[Archive the upload in a single file]' \ '(-C --copy-cmd)-c[Copy the share link to your clipboard]' \ '(-C --copy-cmd)--copy[Copy the share link to your clipboard]' \ '(-c --copy)-C[Copy the ffsend download command to your clipboard]' \ '(-c --copy)--copy-cmd[Copy the ffsend download command to your clipboard]' \ '-S[Shorten share URLs with a public service]' \ '--shorten[Shorten share URLs with a public service]' \ '-Q[Print a QR code for the share URL]' \ '--qrcode[Print a QR code for the share URL]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':FILE -- The file(s) to upload:_files' \ && ret=0 ;; (upload) _arguments "${_arguments_options[@]}" \ '-p+[Protect the file with a password]' \ '--password=[Protect the file with a password]' \ '-d+[The file download limit]' \ '--download-limit=[The file download limit]' \ '-e+[The file expiry time]' \ '--expiry-time=[The file expiry time]' \ '-h+[The remote host to upload to]' \ '--host=[The remote host to upload to]' \ '-n+[Rename the file being uploaded]' \ '--name=[Rename the file being uploaded]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '(-p --password)-P[Protect the file with a generated passphrase]' \ '(-p --password)--gen-passphrase[Protect the file with a generated passphrase]' \ '-o[Open the share link in your browser]' \ '--open[Open the share link in your browser]' \ '-D[Delete local file after upload]' \ '--delete[Delete local file after upload]' \ '-a[Archive the upload in a single file]' \ '--archive[Archive the upload in a single file]' \ '(-C --copy-cmd)-c[Copy the share link to your clipboard]' \ '(-C --copy-cmd)--copy[Copy the share link to your clipboard]' \ '(-c --copy)-C[Copy the ffsend download command to your clipboard]' \ '(-c --copy)--copy-cmd[Copy the ffsend download command to your clipboard]' \ '-S[Shorten share URLs with a public service]' \ '--shorten[Shorten share URLs with a public service]' \ '-Q[Print a QR code for the share URL]' \ '--qrcode[Print a QR code for the share URL]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ ':FILE -- The file(s) to upload:_files' \ && ret=0 ;; (ver) _arguments "${_arguments_options[@]}" \ '-h+[The remote host to upload to]' \ '--host=[The remote host to upload to]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ && ret=0 ;; (v) _arguments "${_arguments_options[@]}" \ '-h+[The remote host to upload to]' \ '--host=[The remote host to upload to]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ && ret=0 ;; (version) _arguments "${_arguments_options[@]}" \ '-h+[The remote host to upload to]' \ '--host=[The remote host to upload to]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ && ret=0 ;; (h) _arguments "${_arguments_options[@]}" \ '-R+[Remove history entry]' \ '--rm=[Remove history entry]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-C[Clear all history]' \ '--clear[Clear all history]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ && ret=0 ;; (ls) _arguments "${_arguments_options[@]}" \ '-R+[Remove history entry]' \ '--rm=[Remove history entry]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-C[Clear all history]' \ '--clear[Clear all history]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ && ret=0 ;; (history) _arguments "${_arguments_options[@]}" \ '-R+[Remove history entry]' \ '--rm=[Remove history entry]' \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-C[Clear all history]' \ '--clear[Clear all history]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ && ret=0 ;; (help) _arguments "${_arguments_options[@]}" \ '-t+[Request timeout (0 to disable)]' \ '--timeout=[Request timeout (0 to disable)]' \ '-T+[Transfer timeout (0 to disable)]' \ '--transfer-timeout=[Transfer timeout (0 to disable)]' \ '-A+[Server API version to use, '\''-'\'' to lookup]' \ '--api=[Server API version to use, '\''-'\'' to lookup]' \ '--basic-auth=[Protected proxy HTTP basic authentication credentials (not FxA)]' \ '-H+[Use the specified history file]' \ '--history=[Use the specified history file]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ '-f[Force the action, ignore warnings]' \ '--force[Force the action, ignore warnings]' \ '-I[Not interactive, do not prompt]' \ '--no-interact[Not interactive, do not prompt]' \ '-y[Assume yes for prompts]' \ '--yes[Assume yes for prompts]' \ '-q[Produce output suitable for logging and automation]' \ '--quiet[Produce output suitable for logging and automation]' \ '*-v[Enable verbose information and logging]' \ '*--verbose[Enable verbose information and logging]' \ '-i[Don'\''t update local history for actions]' \ '--incognito[Don'\''t update local history for actions]' \ && ret=0 ;; esac ;; esac } (( $+functions[_ffsend_commands] )) || _ffsend_commands() { local commands; commands=( "debug:View debug information" \ "dbg:View debug information" \ "delete:Delete a shared file" \ "del:Delete a shared file" \ "rm:Delete a shared file" \ "download:Download files" \ "d:Download files" \ "down:Download files" \ "exists:Check whether a remote file exists" \ "e:Check whether a remote file exists" \ "generate:Generate assets" \ "gen:Generate assets" \ "info:Fetch info about a shared file" \ "i:Fetch info about a shared file" \ "parameters:Change parameters of a shared file" \ "params:Change parameters of a shared file" \ "password:Change the password of a shared file" \ "pass:Change the password of a shared file" \ "p:Change the password of a shared file" \ "upload:Upload files" \ "u:Upload files" \ "up:Upload files" \ "version:Determine the Send server version" \ "v:Determine the Send server version" \ "history:View file history" \ "h:View file history" \ "help:Prints this message or the help of the given subcommand(s)" \ ) _describe -t commands 'ffsend commands' commands "$@" } (( $+functions[_ffsend__complete_commands] )) || _ffsend__complete_commands() { local commands; commands=( ) _describe -t commands 'ffsend complete commands' commands "$@" } (( $+functions[_ffsend__generate__complete_commands] )) || _ffsend__generate__complete_commands() { local commands; commands=( ) _describe -t commands 'ffsend generate complete commands' commands "$@" } (( $+functions[_ffsend__completion_commands] )) || _ffsend__completion_commands() { local commands; commands=( ) _describe -t commands 'ffsend completion commands' commands "$@" } (( $+functions[_ffsend__generate__completion_commands] )) || _ffsend__generate__completion_commands() { local commands; commands=( ) _describe -t commands 'ffsend generate completion commands' commands "$@" } (( $+functions[_ffsend__generate__completions_commands] )) || _ffsend__generate__completions_commands() { local commands; commands=( ) _describe -t commands 'ffsend generate completions commands' commands "$@" } (( $+functions[_d_commands] )) || _d_commands() { local commands; commands=( ) _describe -t commands 'd commands' commands "$@" } (( $+functions[_ffsend__d_commands] )) || _ffsend__d_commands() { local commands; commands=( ) _describe -t commands 'ffsend d commands' commands "$@" } (( $+functions[_dbg_commands] )) || _dbg_commands() { local commands; commands=( ) _describe -t commands 'dbg commands' commands "$@" } (( $+functions[_ffsend__dbg_commands] )) || _ffsend__dbg_commands() { local commands; commands=( ) _describe -t commands 'ffsend dbg commands' commands "$@" } (( $+functions[_ffsend__debug_commands] )) || _ffsend__debug_commands() { local commands; commands=( ) _describe -t commands 'ffsend debug commands' commands "$@" } (( $+functions[_del_commands] )) || _del_commands() { local commands; commands=( ) _describe -t commands 'del commands' commands "$@" } (( $+functions[_ffsend__del_commands] )) || _ffsend__del_commands() { local commands; commands=( ) _describe -t commands 'ffsend del commands' commands "$@" } (( $+functions[_ffsend__delete_commands] )) || _ffsend__delete_commands() { local commands; commands=( ) _describe -t commands 'ffsend delete commands' commands "$@" } (( $+functions[_down_commands] )) || _down_commands() { local commands; commands=( ) _describe -t commands 'down commands' commands "$@" } (( $+functions[_ffsend__down_commands] )) || _ffsend__down_commands() { local commands; commands=( ) _describe -t commands 'ffsend down commands' commands "$@" } (( $+functions[_ffsend__download_commands] )) || _ffsend__download_commands() { local commands; commands=( ) _describe -t commands 'ffsend download commands' commands "$@" } (( $+functions[_e_commands] )) || _e_commands() { local commands; commands=( ) _describe -t commands 'e commands' commands "$@" } (( $+functions[_ffsend__e_commands] )) || _ffsend__e_commands() { local commands; commands=( ) _describe -t commands 'ffsend e commands' commands "$@" } (( $+functions[_exist_commands] )) || _exist_commands() { local commands; commands=( ) _describe -t commands 'exist commands' commands "$@" } (( $+functions[_ffsend__exist_commands] )) || _ffsend__exist_commands() { local commands; commands=( ) _describe -t commands 'ffsend exist commands' commands "$@" } (( $+functions[_ffsend__exists_commands] )) || _ffsend__exists_commands() { local commands; commands=( ) _describe -t commands 'ffsend exists commands' commands "$@" } (( $+functions[_gen_commands] )) || _gen_commands() { local commands; commands=( "completions:Shell completions" \ "help:Prints this message or the help of the given subcommand(s)" \ ) _describe -t commands 'gen commands' commands "$@" } (( $+functions[_ffsend__generate_commands] )) || _ffsend__generate_commands() { local commands; commands=( "completions:Shell completions" \ "help:Prints this message or the help of the given subcommand(s)" \ ) _describe -t commands 'ffsend generate commands' commands "$@" } (( $+functions[_ffsend__h_commands] )) || _ffsend__h_commands() { local commands; commands=( ) _describe -t commands 'ffsend h commands' commands "$@" } (( $+functions[_h_commands] )) || _h_commands() { local commands; commands=( ) _describe -t commands 'h commands' commands "$@" } (( $+functions[_ffsend__generate__help_commands] )) || _ffsend__generate__help_commands() { local commands; commands=( ) _describe -t commands 'ffsend generate help commands' commands "$@" } (( $+functions[_ffsend__help_commands] )) || _ffsend__help_commands() { local commands; commands=( ) _describe -t commands 'ffsend help commands' commands "$@" } (( $+functions[_ffsend__history_commands] )) || _ffsend__history_commands() { local commands; commands=( ) _describe -t commands 'ffsend history commands' commands "$@" } (( $+functions[_ffsend__i_commands] )) || _ffsend__i_commands() { local commands; commands=( ) _describe -t commands 'ffsend i commands' commands "$@" } (( $+functions[_i_commands] )) || _i_commands() { local commands; commands=( ) _describe -t commands 'i commands' commands "$@" } (( $+functions[_ffsend__info_commands] )) || _ffsend__info_commands() { local commands; commands=( ) _describe -t commands 'ffsend info commands' commands "$@" } (( $+functions[_ffsend__information_commands] )) || _ffsend__information_commands() { local commands; commands=( ) _describe -t commands 'ffsend information commands' commands "$@" } (( $+functions[_information_commands] )) || _information_commands() { local commands; commands=( ) _describe -t commands 'information commands' commands "$@" } (( $+functions[_ffsend__ls_commands] )) || _ffsend__ls_commands() { local commands; commands=( ) _describe -t commands 'ffsend ls commands' commands "$@" } (( $+functions[_ls_commands] )) || _ls_commands() { local commands; commands=( ) _describe -t commands 'ls commands' commands "$@" } (( $+functions[_ffsend__p_commands] )) || _ffsend__p_commands() { local commands; commands=( ) _describe -t commands 'ffsend p commands' commands "$@" } (( $+functions[_p_commands] )) || _p_commands() { local commands; commands=( ) _describe -t commands 'p commands' commands "$@" } (( $+functions[_ffsend__param_commands] )) || _ffsend__param_commands() { local commands; commands=( ) _describe -t commands 'ffsend param commands' commands "$@" } (( $+functions[_param_commands] )) || _param_commands() { local commands; commands=( ) _describe -t commands 'param commands' commands "$@" } (( $+functions[_ffsend__parameter_commands] )) || _ffsend__parameter_commands() { local commands; commands=( ) _describe -t commands 'ffsend parameter commands' commands "$@" } (( $+functions[_parameter_commands] )) || _parameter_commands() { local commands; commands=( ) _describe -t commands 'parameter commands' commands "$@" } (( $+functions[_ffsend__parameters_commands] )) || _ffsend__parameters_commands() { local commands; commands=( ) _describe -t commands 'ffsend parameters commands' commands "$@" } (( $+functions[_ffsend__params_commands] )) || _ffsend__params_commands() { local commands; commands=( ) _describe -t commands 'ffsend params commands' commands "$@" } (( $+functions[_params_commands] )) || _params_commands() { local commands; commands=( ) _describe -t commands 'params commands' commands "$@" } (( $+functions[_ffsend__pass_commands] )) || _ffsend__pass_commands() { local commands; commands=( ) _describe -t commands 'ffsend pass commands' commands "$@" } (( $+functions[_pass_commands] )) || _pass_commands() { local commands; commands=( ) _describe -t commands 'pass commands' commands "$@" } (( $+functions[_ffsend__password_commands] )) || _ffsend__password_commands() { local commands; commands=( ) _describe -t commands 'ffsend password commands' commands "$@" } (( $+functions[_ffsend__rm_commands] )) || _ffsend__rm_commands() { local commands; commands=( ) _describe -t commands 'ffsend rm commands' commands "$@" } (( $+functions[_rm_commands] )) || _rm_commands() { local commands; commands=( ) _describe -t commands 'rm commands' commands "$@" } (( $+functions[_ffsend__u_commands] )) || _ffsend__u_commands() { local commands; commands=( ) _describe -t commands 'ffsend u commands' commands "$@" } (( $+functions[_u_commands] )) || _u_commands() { local commands; commands=( ) _describe -t commands 'u commands' commands "$@" } (( $+functions[_ffsend__up_commands] )) || _ffsend__up_commands() { local commands; commands=( ) _describe -t commands 'ffsend up commands' commands "$@" } (( $+functions[_up_commands] )) || _up_commands() { local commands; commands=( ) _describe -t commands 'up commands' commands "$@" } (( $+functions[_ffsend__upload_commands] )) || _ffsend__upload_commands() { local commands; commands=( ) _describe -t commands 'ffsend upload commands' commands "$@" } (( $+functions[_ffsend__v_commands] )) || _ffsend__v_commands() { local commands; commands=( ) _describe -t commands 'ffsend v commands' commands "$@" } (( $+functions[_v_commands] )) || _v_commands() { local commands; commands=( ) _describe -t commands 'v commands' commands "$@" } (( $+functions[_ffsend__ver_commands] )) || _ffsend__ver_commands() { local commands; commands=( ) _describe -t commands 'ffsend ver commands' commands "$@" } (( $+functions[_ver_commands] )) || _ver_commands() { local commands; commands=( ) _describe -t commands 'ver commands' commands "$@" } (( $+functions[_ffsend__version_commands] )) || _ffsend__version_commands() { local commands; commands=( ) _describe -t commands 'ffsend version commands' commands "$@" } _ffsend "$@" ================================================ FILE: contrib/completions/_ffsend.ps1 ================================================ using namespace System.Management.Automation using namespace System.Management.Automation.Language Register-ArgumentCompleter -Native -CommandName 'ffsend' -ScriptBlock { param($wordToComplete, $commandAst, $cursorPosition) $commandElements = $commandAst.CommandElements $command = @( 'ffsend' for ($i = 1; $i -lt $commandElements.Count; $i++) { $element = $commandElements[$i] if ($element -isnot [StringConstantExpressionAst] -or $element.StringConstantType -ne [StringConstantType]::BareWord -or $element.Value.StartsWith('-')) { break } $element.Value }) -join ';' $completions = @(switch ($command) { 'ffsend' { [CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('--timeout', 'timeout', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('-T', 'T', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('--transfer-timeout', 'transfer-timeout', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('-A', 'A', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--api', 'api', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--basic-auth', 'basic-auth', [CompletionResultType]::ParameterName, 'Protected proxy HTTP basic authentication credentials (not FxA)') [CompletionResult]::new('-H', 'H', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('--history', 'history', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('-f', 'f', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('--force', 'force', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('-I', 'I', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('--no-interact', 'no-interact', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('-y', 'y', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('-q', 'q', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('--quiet', 'quiet', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') [CompletionResult]::new('--incognito', 'incognito', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('debug', 'debug', [CompletionResultType]::ParameterValue, 'View debug information') [CompletionResult]::new('delete', 'delete', [CompletionResultType]::ParameterValue, 'Delete a shared file') [CompletionResult]::new('download', 'download', [CompletionResultType]::ParameterValue, 'Download files') [CompletionResult]::new('exists', 'exists', [CompletionResultType]::ParameterValue, 'Check whether a remote file exists') [CompletionResult]::new('generate', 'generate', [CompletionResultType]::ParameterValue, 'Generate assets') [CompletionResult]::new('info', 'info', [CompletionResultType]::ParameterValue, 'Fetch info about a shared file') [CompletionResult]::new('parameters', 'parameters', [CompletionResultType]::ParameterValue, 'Change parameters of a shared file') [CompletionResult]::new('password', 'password', [CompletionResultType]::ParameterValue, 'Change the password of a shared file') [CompletionResult]::new('upload', 'upload', [CompletionResultType]::ParameterValue, 'Upload files') [CompletionResult]::new('version', 'version', [CompletionResultType]::ParameterValue, 'Determine the Send server version') [CompletionResult]::new('history', 'history', [CompletionResultType]::ParameterValue, 'View file history') [CompletionResult]::new('help', 'help', [CompletionResultType]::ParameterValue, 'Prints this message or the help of the given subcommand(s)') break } 'ffsend;debug' { [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'The remote host to upload to') [CompletionResult]::new('--host', 'host', [CompletionResultType]::ParameterName, 'The remote host to upload to') [CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('--timeout', 'timeout', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('-T', 'T', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('--transfer-timeout', 'transfer-timeout', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('-A', 'A', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--api', 'api', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--basic-auth', 'basic-auth', [CompletionResultType]::ParameterName, 'Protected proxy HTTP basic authentication credentials (not FxA)') [CompletionResult]::new('-H', 'H', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('--history', 'history', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('-f', 'f', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('--force', 'force', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('-I', 'I', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('--no-interact', 'no-interact', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('-y', 'y', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('-q', 'q', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('--quiet', 'quiet', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') [CompletionResult]::new('--incognito', 'incognito', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') break } 'ffsend;delete' { [CompletionResult]::new('-o', 'o', [CompletionResultType]::ParameterName, 'Specify the file owner token') [CompletionResult]::new('--owner', 'owner', [CompletionResultType]::ParameterName, 'Specify the file owner token') [CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('--timeout', 'timeout', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('-T', 'T', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('--transfer-timeout', 'transfer-timeout', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('-A', 'A', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--api', 'api', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--basic-auth', 'basic-auth', [CompletionResultType]::ParameterName, 'Protected proxy HTTP basic authentication credentials (not FxA)') [CompletionResult]::new('-H', 'H', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('--history', 'history', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('-f', 'f', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('--force', 'force', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('-I', 'I', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('--no-interact', 'no-interact', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('-y', 'y', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('-q', 'q', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('--quiet', 'quiet', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') [CompletionResult]::new('--incognito', 'incognito', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') break } 'ffsend;download' { [CompletionResult]::new('-p', 'p', [CompletionResultType]::ParameterName, 'Unlock a password protected file') [CompletionResult]::new('--password', 'password', [CompletionResultType]::ParameterName, 'Unlock a password protected file') [CompletionResult]::new('-o', 'o', [CompletionResultType]::ParameterName, 'Output file or directory') [CompletionResult]::new('--output', 'output', [CompletionResultType]::ParameterName, 'Output file or directory') [CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('--timeout', 'timeout', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('-T', 'T', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('--transfer-timeout', 'transfer-timeout', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('-A', 'A', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--api', 'api', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--basic-auth', 'basic-auth', [CompletionResultType]::ParameterName, 'Protected proxy HTTP basic authentication credentials (not FxA)') [CompletionResult]::new('-H', 'H', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('--history', 'history', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('-e', 'e', [CompletionResultType]::ParameterName, 'Extract an archived file') [CompletionResult]::new('--extract', 'extract', [CompletionResultType]::ParameterName, 'Extract an archived file') [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('-f', 'f', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('--force', 'force', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('-I', 'I', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('--no-interact', 'no-interact', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('-y', 'y', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('-q', 'q', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('--quiet', 'quiet', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') [CompletionResult]::new('--incognito', 'incognito', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') break } 'ffsend;exists' { [CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('--timeout', 'timeout', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('-T', 'T', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('--transfer-timeout', 'transfer-timeout', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('-A', 'A', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--api', 'api', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--basic-auth', 'basic-auth', [CompletionResultType]::ParameterName, 'Protected proxy HTTP basic authentication credentials (not FxA)') [CompletionResult]::new('-H', 'H', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('--history', 'history', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('-f', 'f', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('--force', 'force', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('-I', 'I', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('--no-interact', 'no-interact', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('-y', 'y', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('-q', 'q', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('--quiet', 'quiet', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') [CompletionResult]::new('--incognito', 'incognito', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') break } 'ffsend;generate' { [CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('--timeout', 'timeout', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('-T', 'T', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('--transfer-timeout', 'transfer-timeout', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('-A', 'A', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--api', 'api', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--basic-auth', 'basic-auth', [CompletionResultType]::ParameterName, 'Protected proxy HTTP basic authentication credentials (not FxA)') [CompletionResult]::new('-H', 'H', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('--history', 'history', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('-f', 'f', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('--force', 'force', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('-I', 'I', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('--no-interact', 'no-interact', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('-y', 'y', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('-q', 'q', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('--quiet', 'quiet', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') [CompletionResult]::new('--incognito', 'incognito', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') [CompletionResult]::new('completions', 'completions', [CompletionResultType]::ParameterValue, 'Shell completions') [CompletionResult]::new('help', 'help', [CompletionResultType]::ParameterValue, 'Prints this message or the help of the given subcommand(s)') break } 'ffsend;generate;completions' { [CompletionResult]::new('-o', 'o', [CompletionResultType]::ParameterName, 'Shell completion files output directory') [CompletionResult]::new('--output', 'output', [CompletionResultType]::ParameterName, 'Shell completion files output directory') [CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('--timeout', 'timeout', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('-T', 'T', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('--transfer-timeout', 'transfer-timeout', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('-A', 'A', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--api', 'api', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--basic-auth', 'basic-auth', [CompletionResultType]::ParameterName, 'Protected proxy HTTP basic authentication credentials (not FxA)') [CompletionResult]::new('-H', 'H', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('--history', 'history', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('-f', 'f', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('--force', 'force', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('-I', 'I', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('--no-interact', 'no-interact', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('-y', 'y', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('-q', 'q', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('--quiet', 'quiet', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') [CompletionResult]::new('--incognito', 'incognito', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') break } 'ffsend;generate;help' { [CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('--timeout', 'timeout', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('-T', 'T', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('--transfer-timeout', 'transfer-timeout', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('-A', 'A', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--api', 'api', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--basic-auth', 'basic-auth', [CompletionResultType]::ParameterName, 'Protected proxy HTTP basic authentication credentials (not FxA)') [CompletionResult]::new('-H', 'H', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('--history', 'history', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('-f', 'f', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('--force', 'force', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('-I', 'I', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('--no-interact', 'no-interact', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('-y', 'y', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('-q', 'q', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('--quiet', 'quiet', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') [CompletionResult]::new('--incognito', 'incognito', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') break } 'ffsend;info' { [CompletionResult]::new('-o', 'o', [CompletionResultType]::ParameterName, 'Specify the file owner token') [CompletionResult]::new('--owner', 'owner', [CompletionResultType]::ParameterName, 'Specify the file owner token') [CompletionResult]::new('-p', 'p', [CompletionResultType]::ParameterName, 'Unlock a password protected file') [CompletionResult]::new('--password', 'password', [CompletionResultType]::ParameterName, 'Unlock a password protected file') [CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('--timeout', 'timeout', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('-T', 'T', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('--transfer-timeout', 'transfer-timeout', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('-A', 'A', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--api', 'api', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--basic-auth', 'basic-auth', [CompletionResultType]::ParameterName, 'Protected proxy HTTP basic authentication credentials (not FxA)') [CompletionResult]::new('-H', 'H', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('--history', 'history', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('-f', 'f', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('--force', 'force', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('-I', 'I', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('--no-interact', 'no-interact', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('-y', 'y', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('-q', 'q', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('--quiet', 'quiet', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') [CompletionResult]::new('--incognito', 'incognito', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') break } 'ffsend;parameters' { [CompletionResult]::new('-o', 'o', [CompletionResultType]::ParameterName, 'Specify the file owner token') [CompletionResult]::new('--owner', 'owner', [CompletionResultType]::ParameterName, 'Specify the file owner token') [CompletionResult]::new('-d', 'd', [CompletionResultType]::ParameterName, 'The file download limit') [CompletionResult]::new('--download-limit', 'download-limit', [CompletionResultType]::ParameterName, 'The file download limit') [CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('--timeout', 'timeout', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('-T', 'T', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('--transfer-timeout', 'transfer-timeout', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('-A', 'A', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--api', 'api', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--basic-auth', 'basic-auth', [CompletionResultType]::ParameterName, 'Protected proxy HTTP basic authentication credentials (not FxA)') [CompletionResult]::new('-H', 'H', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('--history', 'history', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('-f', 'f', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('--force', 'force', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('-I', 'I', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('--no-interact', 'no-interact', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('-y', 'y', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('-q', 'q', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('--quiet', 'quiet', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') [CompletionResult]::new('--incognito', 'incognito', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') break } 'ffsend;password' { [CompletionResult]::new('-p', 'p', [CompletionResultType]::ParameterName, 'Specify a password, do not prompt') [CompletionResult]::new('--password', 'password', [CompletionResultType]::ParameterName, 'Specify a password, do not prompt') [CompletionResult]::new('-o', 'o', [CompletionResultType]::ParameterName, 'Specify the file owner token') [CompletionResult]::new('--owner', 'owner', [CompletionResultType]::ParameterName, 'Specify the file owner token') [CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('--timeout', 'timeout', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('-T', 'T', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('--transfer-timeout', 'transfer-timeout', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('-A', 'A', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--api', 'api', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--basic-auth', 'basic-auth', [CompletionResultType]::ParameterName, 'Protected proxy HTTP basic authentication credentials (not FxA)') [CompletionResult]::new('-H', 'H', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('--history', 'history', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('-P', 'P', [CompletionResultType]::ParameterName, 'Protect the file with a generated passphrase') [CompletionResult]::new('--gen-passphrase', 'gen-passphrase', [CompletionResultType]::ParameterName, 'Protect the file with a generated passphrase') [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('-f', 'f', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('--force', 'force', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('-I', 'I', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('--no-interact', 'no-interact', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('-y', 'y', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('-q', 'q', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('--quiet', 'quiet', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') [CompletionResult]::new('--incognito', 'incognito', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') break } 'ffsend;upload' { [CompletionResult]::new('-p', 'p', [CompletionResultType]::ParameterName, 'Protect the file with a password') [CompletionResult]::new('--password', 'password', [CompletionResultType]::ParameterName, 'Protect the file with a password') [CompletionResult]::new('-d', 'd', [CompletionResultType]::ParameterName, 'The file download limit') [CompletionResult]::new('--download-limit', 'download-limit', [CompletionResultType]::ParameterName, 'The file download limit') [CompletionResult]::new('-e', 'e', [CompletionResultType]::ParameterName, 'The file expiry time') [CompletionResult]::new('--expiry-time', 'expiry-time', [CompletionResultType]::ParameterName, 'The file expiry time') [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'The remote host to upload to') [CompletionResult]::new('--host', 'host', [CompletionResultType]::ParameterName, 'The remote host to upload to') [CompletionResult]::new('-n', 'n', [CompletionResultType]::ParameterName, 'Rename the file being uploaded') [CompletionResult]::new('--name', 'name', [CompletionResultType]::ParameterName, 'Rename the file being uploaded') [CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('--timeout', 'timeout', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('-T', 'T', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('--transfer-timeout', 'transfer-timeout', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('-A', 'A', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--api', 'api', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--basic-auth', 'basic-auth', [CompletionResultType]::ParameterName, 'Protected proxy HTTP basic authentication credentials (not FxA)') [CompletionResult]::new('-H', 'H', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('--history', 'history', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('-P', 'P', [CompletionResultType]::ParameterName, 'Protect the file with a generated passphrase') [CompletionResult]::new('--gen-passphrase', 'gen-passphrase', [CompletionResultType]::ParameterName, 'Protect the file with a generated passphrase') [CompletionResult]::new('-o', 'o', [CompletionResultType]::ParameterName, 'Open the share link in your browser') [CompletionResult]::new('--open', 'open', [CompletionResultType]::ParameterName, 'Open the share link in your browser') [CompletionResult]::new('-D', 'D', [CompletionResultType]::ParameterName, 'Delete local file after upload') [CompletionResult]::new('--delete', 'delete', [CompletionResultType]::ParameterName, 'Delete local file after upload') [CompletionResult]::new('-a', 'a', [CompletionResultType]::ParameterName, 'Archive the upload in a single file') [CompletionResult]::new('--archive', 'archive', [CompletionResultType]::ParameterName, 'Archive the upload in a single file') [CompletionResult]::new('-c', 'c', [CompletionResultType]::ParameterName, 'Copy the share link to your clipboard') [CompletionResult]::new('--copy', 'copy', [CompletionResultType]::ParameterName, 'Copy the share link to your clipboard') [CompletionResult]::new('-C', 'C', [CompletionResultType]::ParameterName, 'Copy the ffsend download command to your clipboard') [CompletionResult]::new('--copy-cmd', 'copy-cmd', [CompletionResultType]::ParameterName, 'Copy the ffsend download command to your clipboard') [CompletionResult]::new('-S', 'S', [CompletionResultType]::ParameterName, 'Shorten share URLs with a public service') [CompletionResult]::new('--shorten', 'shorten', [CompletionResultType]::ParameterName, 'Shorten share URLs with a public service') [CompletionResult]::new('-Q', 'Q', [CompletionResultType]::ParameterName, 'Print a QR code for the share URL') [CompletionResult]::new('--qrcode', 'qrcode', [CompletionResultType]::ParameterName, 'Print a QR code for the share URL') [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('-f', 'f', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('--force', 'force', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('-I', 'I', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('--no-interact', 'no-interact', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('-y', 'y', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('-q', 'q', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('--quiet', 'quiet', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') [CompletionResult]::new('--incognito', 'incognito', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') break } 'ffsend;version' { [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'The remote host to upload to') [CompletionResult]::new('--host', 'host', [CompletionResultType]::ParameterName, 'The remote host to upload to') [CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('--timeout', 'timeout', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('-T', 'T', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('--transfer-timeout', 'transfer-timeout', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('-A', 'A', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--api', 'api', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--basic-auth', 'basic-auth', [CompletionResultType]::ParameterName, 'Protected proxy HTTP basic authentication credentials (not FxA)') [CompletionResult]::new('-H', 'H', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('--history', 'history', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('-f', 'f', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('--force', 'force', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('-I', 'I', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('--no-interact', 'no-interact', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('-y', 'y', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('-q', 'q', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('--quiet', 'quiet', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') [CompletionResult]::new('--incognito', 'incognito', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') break } 'ffsend;history' { [CompletionResult]::new('-R', 'R', [CompletionResultType]::ParameterName, 'Remove history entry') [CompletionResult]::new('--rm', 'rm', [CompletionResultType]::ParameterName, 'Remove history entry') [CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('--timeout', 'timeout', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('-T', 'T', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('--transfer-timeout', 'transfer-timeout', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('-A', 'A', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--api', 'api', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--basic-auth', 'basic-auth', [CompletionResultType]::ParameterName, 'Protected proxy HTTP basic authentication credentials (not FxA)') [CompletionResult]::new('-H', 'H', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('--history', 'history', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('-C', 'C', [CompletionResultType]::ParameterName, 'Clear all history') [CompletionResult]::new('--clear', 'clear', [CompletionResultType]::ParameterName, 'Clear all history') [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('-f', 'f', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('--force', 'force', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('-I', 'I', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('--no-interact', 'no-interact', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('-y', 'y', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('-q', 'q', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('--quiet', 'quiet', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') [CompletionResult]::new('--incognito', 'incognito', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') break } 'ffsend;help' { [CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('--timeout', 'timeout', [CompletionResultType]::ParameterName, 'Request timeout (0 to disable)') [CompletionResult]::new('-T', 'T', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('--transfer-timeout', 'transfer-timeout', [CompletionResultType]::ParameterName, 'Transfer timeout (0 to disable)') [CompletionResult]::new('-A', 'A', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--api', 'api', [CompletionResultType]::ParameterName, 'Server API version to use, ''-'' to lookup') [CompletionResult]::new('--basic-auth', 'basic-auth', [CompletionResultType]::ParameterName, 'Protected proxy HTTP basic authentication credentials (not FxA)') [CompletionResult]::new('-H', 'H', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('--history', 'history', [CompletionResultType]::ParameterName, 'Use the specified history file') [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Prints help information') [CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Prints version information') [CompletionResult]::new('-f', 'f', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('--force', 'force', [CompletionResultType]::ParameterName, 'Force the action, ignore warnings') [CompletionResult]::new('-I', 'I', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('--no-interact', 'no-interact', [CompletionResultType]::ParameterName, 'Not interactive, do not prompt') [CompletionResult]::new('-y', 'y', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('--yes', 'yes', [CompletionResultType]::ParameterName, 'Assume yes for prompts') [CompletionResult]::new('-q', 'q', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('--quiet', 'quiet', [CompletionResultType]::ParameterName, 'Produce output suitable for logging and automation') [CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('--verbose', 'verbose', [CompletionResultType]::ParameterName, 'Enable verbose information and logging') [CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') [CompletionResult]::new('--incognito', 'incognito', [CompletionResultType]::ParameterName, 'Don''t update local history for actions') break } }) $completions.Where{ $_.CompletionText -like "$wordToComplete*" } | Sort-Object -Property ListItemText } ================================================ FILE: contrib/completions/ffsend.bash ================================================ _ffsend() { local i cur prev opts cmds COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" cmd="" opts="" for i in ${COMP_WORDS[@]} do case "${i}" in ffsend) cmd="ffsend" ;; complete) cmd+="__complete" ;; completion) cmd+="__completion" ;; completions) cmd+="__completions" ;; d) cmd+="__d" ;; dbg) cmd+="__dbg" ;; debug) cmd+="__debug" ;; del) cmd+="__del" ;; delete) cmd+="__delete" ;; down) cmd+="__down" ;; download) cmd+="__download" ;; e) cmd+="__e" ;; exist) cmd+="__exist" ;; exists) cmd+="__exists" ;; gen) cmd+="__gen" ;; generate) cmd+="__generate" ;; h) cmd+="__h" ;; help) cmd+="__help" ;; history) cmd+="__history" ;; i) cmd+="__i" ;; info) cmd+="__info" ;; information) cmd+="__information" ;; ls) cmd+="__ls" ;; p) cmd+="__p" ;; param) cmd+="__param" ;; parameter) cmd+="__parameter" ;; parameters) cmd+="__parameters" ;; params) cmd+="__params" ;; pass) cmd+="__pass" ;; password) cmd+="__password" ;; rm) cmd+="__rm" ;; u) cmd+="__u" ;; up) cmd+="__up" ;; upload) cmd+="__upload" ;; v) cmd+="__v" ;; ver) cmd+="__ver" ;; version) cmd+="__version" ;; *) ;; esac done case "${cmd}" in ffsend) opts=" -f -I -y -q -v -i -h -V -t -T -A -H --force --no-interact --yes --quiet --verbose --incognito --help --version --timeout --transfer-timeout --api --basic-auth --history debug delete download exists generate info parameters password upload version history help dbg del rm d down e exist gen i information params param parameter pass p u up ver v h ls" if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__d) opts=" -e -h -V -f -I -y -q -v -i -p -o -t -T -A -H --extract --help --version --force --no-interact --yes --quiet --verbose --incognito --password --output --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --password) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -p) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --output) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -o) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__dbg) opts=" -V -f -I -y -q -v -i -h -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --host --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --host) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -h) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__debug) opts=" -V -f -I -y -q -v -i -h -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --host --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --host) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -h) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__del) opts=" -h -V -f -I -y -q -v -i -o -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --owner --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --owner) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -o) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__delete) opts=" -h -V -f -I -y -q -v -i -o -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --owner --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --owner) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -o) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__down) opts=" -e -h -V -f -I -y -q -v -i -p -o -t -T -A -H --extract --help --version --force --no-interact --yes --quiet --verbose --incognito --password --output --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --password) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -p) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --output) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -o) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__download) opts=" -e -h -V -f -I -y -q -v -i -p -o -t -T -A -H --extract --help --version --force --no-interact --yes --quiet --verbose --incognito --password --output --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --password) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -p) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --output) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -o) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__e) opts=" -h -V -f -I -y -q -v -i -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__exist) opts=" -h -V -f -I -y -q -v -i -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__exists) opts=" -h -V -f -I -y -q -v -i -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__gen) opts=" -h -V -f -I -y -q -v -i -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --timeout --transfer-timeout --api --basic-auth --history completions help completion complete" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__generate) opts=" -h -V -f -I -y -q -v -i -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --timeout --transfer-timeout --api --basic-auth --history completions help completion complete" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__generate__complete) opts=" -h -V -f -I -y -q -v -i -o -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --output --timeout --transfer-timeout --api --basic-auth --history ... " if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --output) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -o) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__generate__completion) opts=" -h -V -f -I -y -q -v -i -o -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --output --timeout --transfer-timeout --api --basic-auth --history ... " if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --output) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -o) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__generate__completions) opts=" -h -V -f -I -y -q -v -i -o -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --output --timeout --transfer-timeout --api --basic-auth --history ... " if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --output) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -o) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__generate__help) opts=" -h -V -f -I -y -q -v -i -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__h) opts=" -C -h -V -f -I -y -q -v -i -R -t -T -A -H --clear --help --version --force --no-interact --yes --quiet --verbose --incognito --rm --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --rm) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -R) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__help) opts=" -h -V -f -I -y -q -v -i -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__history) opts=" -C -h -V -f -I -y -q -v -i -R -t -T -A -H --clear --help --version --force --no-interact --yes --quiet --verbose --incognito --rm --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --rm) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -R) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__i) opts=" -h -V -f -I -y -q -v -i -o -p -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --owner --password --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --owner) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -o) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --password) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -p) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__info) opts=" -h -V -f -I -y -q -v -i -o -p -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --owner --password --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --owner) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -o) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --password) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -p) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__information) opts=" -h -V -f -I -y -q -v -i -o -p -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --owner --password --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --owner) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -o) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --password) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -p) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__ls) opts=" -C -h -V -f -I -y -q -v -i -R -t -T -A -H --clear --help --version --force --no-interact --yes --quiet --verbose --incognito --rm --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --rm) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -R) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__p) opts=" -P -h -V -f -I -y -q -v -i -p -o -t -T -A -H --gen-passphrase --help --version --force --no-interact --yes --quiet --verbose --incognito --password --owner --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --password) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -p) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --owner) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -o) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__param) opts=" -h -V -f -I -y -q -v -i -o -d -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --owner --download-limit --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --owner) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -o) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --download-limit) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -d) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__parameter) opts=" -h -V -f -I -y -q -v -i -o -d -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --owner --download-limit --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --owner) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -o) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --download-limit) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -d) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__parameters) opts=" -h -V -f -I -y -q -v -i -o -d -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --owner --download-limit --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --owner) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -o) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --download-limit) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -d) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__params) opts=" -h -V -f -I -y -q -v -i -o -d -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --owner --download-limit --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --owner) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -o) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --download-limit) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -d) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__pass) opts=" -P -h -V -f -I -y -q -v -i -p -o -t -T -A -H --gen-passphrase --help --version --force --no-interact --yes --quiet --verbose --incognito --password --owner --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --password) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -p) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --owner) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -o) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__password) opts=" -P -h -V -f -I -y -q -v -i -p -o -t -T -A -H --gen-passphrase --help --version --force --no-interact --yes --quiet --verbose --incognito --password --owner --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --password) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -p) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --owner) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -o) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__rm) opts=" -h -V -f -I -y -q -v -i -o -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --owner --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --owner) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -o) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__u) opts=" -P -o -D -a -c -C -S -Q -V -f -I -y -q -v -i -p -d -e -h -n -t -T -A -H --gen-passphrase --open --delete --archive --copy --copy-cmd --shorten --qrcode --help --version --force --no-interact --yes --quiet --verbose --incognito --password --download-limit --expiry-time --host --name --timeout --transfer-timeout --api --basic-auth --history ... " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --password) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -p) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --download-limit) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -d) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --expiry-time) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -e) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --host) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -h) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --name) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -n) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__up) opts=" -P -o -D -a -c -C -S -Q -V -f -I -y -q -v -i -p -d -e -h -n -t -T -A -H --gen-passphrase --open --delete --archive --copy --copy-cmd --shorten --qrcode --help --version --force --no-interact --yes --quiet --verbose --incognito --password --download-limit --expiry-time --host --name --timeout --transfer-timeout --api --basic-auth --history ... " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --password) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -p) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --download-limit) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -d) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --expiry-time) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -e) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --host) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -h) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --name) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -n) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__upload) opts=" -P -o -D -a -c -C -S -Q -V -f -I -y -q -v -i -p -d -e -h -n -t -T -A -H --gen-passphrase --open --delete --archive --copy --copy-cmd --shorten --qrcode --help --version --force --no-interact --yes --quiet --verbose --incognito --password --download-limit --expiry-time --host --name --timeout --transfer-timeout --api --basic-auth --history ... " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --password) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -p) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --download-limit) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -d) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --expiry-time) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -e) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --host) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -h) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --name) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -n) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__v) opts=" -V -f -I -y -q -v -i -h -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --host --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --host) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -h) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__ver) opts=" -V -f -I -y -q -v -i -h -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --host --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --host) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -h) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; ffsend__version) opts=" -V -f -I -y -q -v -i -h -t -T -A -H --help --version --force --no-interact --yes --quiet --verbose --incognito --host --timeout --transfer-timeout --api --basic-auth --history " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --host) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -h) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -t) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --transfer-timeout) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -T) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --api) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -A) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --basic-auth) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --history) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; esac } complete -F _ffsend -o bashdefault -o default ffsend ================================================ FILE: contrib/completions/ffsend.elv ================================================ edit:completion:arg-completer[ffsend] = [@words]{ fn spaces [n]{ repeat $n ' ' | joins '' } fn cand [text desc]{ edit:complex-candidate $text &display-suffix=' '(spaces (- 14 (wcswidth $text)))$desc } command = 'ffsend' for word $words[1:-1] { if (has-prefix $word '-') { break } command = $command';'$word } completions = [ &'ffsend'= { cand -t 'Request timeout (0 to disable)' cand --timeout 'Request timeout (0 to disable)' cand -T 'Transfer timeout (0 to disable)' cand --transfer-timeout 'Transfer timeout (0 to disable)' cand -A 'Server API version to use, ''-'' to lookup' cand --api 'Server API version to use, ''-'' to lookup' cand --basic-auth 'Protected proxy HTTP basic authentication credentials (not FxA)' cand -H 'Use the specified history file' cand --history 'Use the specified history file' cand -f 'Force the action, ignore warnings' cand --force 'Force the action, ignore warnings' cand -I 'Not interactive, do not prompt' cand --no-interact 'Not interactive, do not prompt' cand -y 'Assume yes for prompts' cand --yes 'Assume yes for prompts' cand -q 'Produce output suitable for logging and automation' cand --quiet 'Produce output suitable for logging and automation' cand -v 'Enable verbose information and logging' cand --verbose 'Enable verbose information and logging' cand -i 'Don''t update local history for actions' cand --incognito 'Don''t update local history for actions' cand -h 'Prints help information' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' cand debug 'View debug information' cand delete 'Delete a shared file' cand download 'Download files' cand exists 'Check whether a remote file exists' cand generate 'Generate assets' cand info 'Fetch info about a shared file' cand parameters 'Change parameters of a shared file' cand password 'Change the password of a shared file' cand upload 'Upload files' cand version 'Determine the Send server version' cand history 'View file history' cand help 'Prints this message or the help of the given subcommand(s)' } &'ffsend;debug'= { cand -h 'The remote host to upload to' cand --host 'The remote host to upload to' cand -t 'Request timeout (0 to disable)' cand --timeout 'Request timeout (0 to disable)' cand -T 'Transfer timeout (0 to disable)' cand --transfer-timeout 'Transfer timeout (0 to disable)' cand -A 'Server API version to use, ''-'' to lookup' cand --api 'Server API version to use, ''-'' to lookup' cand --basic-auth 'Protected proxy HTTP basic authentication credentials (not FxA)' cand -H 'Use the specified history file' cand --history 'Use the specified history file' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' cand -f 'Force the action, ignore warnings' cand --force 'Force the action, ignore warnings' cand -I 'Not interactive, do not prompt' cand --no-interact 'Not interactive, do not prompt' cand -y 'Assume yes for prompts' cand --yes 'Assume yes for prompts' cand -q 'Produce output suitable for logging and automation' cand --quiet 'Produce output suitable for logging and automation' cand -v 'Enable verbose information and logging' cand --verbose 'Enable verbose information and logging' cand -i 'Don''t update local history for actions' cand --incognito 'Don''t update local history for actions' } &'ffsend;delete'= { cand -o 'Specify the file owner token' cand --owner 'Specify the file owner token' cand -t 'Request timeout (0 to disable)' cand --timeout 'Request timeout (0 to disable)' cand -T 'Transfer timeout (0 to disable)' cand --transfer-timeout 'Transfer timeout (0 to disable)' cand -A 'Server API version to use, ''-'' to lookup' cand --api 'Server API version to use, ''-'' to lookup' cand --basic-auth 'Protected proxy HTTP basic authentication credentials (not FxA)' cand -H 'Use the specified history file' cand --history 'Use the specified history file' cand -h 'Prints help information' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' cand -f 'Force the action, ignore warnings' cand --force 'Force the action, ignore warnings' cand -I 'Not interactive, do not prompt' cand --no-interact 'Not interactive, do not prompt' cand -y 'Assume yes for prompts' cand --yes 'Assume yes for prompts' cand -q 'Produce output suitable for logging and automation' cand --quiet 'Produce output suitable for logging and automation' cand -v 'Enable verbose information and logging' cand --verbose 'Enable verbose information and logging' cand -i 'Don''t update local history for actions' cand --incognito 'Don''t update local history for actions' } &'ffsend;download'= { cand -p 'Unlock a password protected file' cand --password 'Unlock a password protected file' cand -o 'Output file or directory' cand --output 'Output file or directory' cand -t 'Request timeout (0 to disable)' cand --timeout 'Request timeout (0 to disable)' cand -T 'Transfer timeout (0 to disable)' cand --transfer-timeout 'Transfer timeout (0 to disable)' cand -A 'Server API version to use, ''-'' to lookup' cand --api 'Server API version to use, ''-'' to lookup' cand --basic-auth 'Protected proxy HTTP basic authentication credentials (not FxA)' cand -H 'Use the specified history file' cand --history 'Use the specified history file' cand -e 'Extract an archived file' cand --extract 'Extract an archived file' cand -h 'Prints help information' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' cand -f 'Force the action, ignore warnings' cand --force 'Force the action, ignore warnings' cand -I 'Not interactive, do not prompt' cand --no-interact 'Not interactive, do not prompt' cand -y 'Assume yes for prompts' cand --yes 'Assume yes for prompts' cand -q 'Produce output suitable for logging and automation' cand --quiet 'Produce output suitable for logging and automation' cand -v 'Enable verbose information and logging' cand --verbose 'Enable verbose information and logging' cand -i 'Don''t update local history for actions' cand --incognito 'Don''t update local history for actions' } &'ffsend;exists'= { cand -t 'Request timeout (0 to disable)' cand --timeout 'Request timeout (0 to disable)' cand -T 'Transfer timeout (0 to disable)' cand --transfer-timeout 'Transfer timeout (0 to disable)' cand -A 'Server API version to use, ''-'' to lookup' cand --api 'Server API version to use, ''-'' to lookup' cand --basic-auth 'Protected proxy HTTP basic authentication credentials (not FxA)' cand -H 'Use the specified history file' cand --history 'Use the specified history file' cand -h 'Prints help information' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' cand -f 'Force the action, ignore warnings' cand --force 'Force the action, ignore warnings' cand -I 'Not interactive, do not prompt' cand --no-interact 'Not interactive, do not prompt' cand -y 'Assume yes for prompts' cand --yes 'Assume yes for prompts' cand -q 'Produce output suitable for logging and automation' cand --quiet 'Produce output suitable for logging and automation' cand -v 'Enable verbose information and logging' cand --verbose 'Enable verbose information and logging' cand -i 'Don''t update local history for actions' cand --incognito 'Don''t update local history for actions' } &'ffsend;generate'= { cand -t 'Request timeout (0 to disable)' cand --timeout 'Request timeout (0 to disable)' cand -T 'Transfer timeout (0 to disable)' cand --transfer-timeout 'Transfer timeout (0 to disable)' cand -A 'Server API version to use, ''-'' to lookup' cand --api 'Server API version to use, ''-'' to lookup' cand --basic-auth 'Protected proxy HTTP basic authentication credentials (not FxA)' cand -H 'Use the specified history file' cand --history 'Use the specified history file' cand -h 'Prints help information' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' cand -f 'Force the action, ignore warnings' cand --force 'Force the action, ignore warnings' cand -I 'Not interactive, do not prompt' cand --no-interact 'Not interactive, do not prompt' cand -y 'Assume yes for prompts' cand --yes 'Assume yes for prompts' cand -q 'Produce output suitable for logging and automation' cand --quiet 'Produce output suitable for logging and automation' cand -v 'Enable verbose information and logging' cand --verbose 'Enable verbose information and logging' cand -i 'Don''t update local history for actions' cand --incognito 'Don''t update local history for actions' cand completions 'Shell completions' cand help 'Prints this message or the help of the given subcommand(s)' } &'ffsend;generate;completions'= { cand -o 'Shell completion files output directory' cand --output 'Shell completion files output directory' cand -t 'Request timeout (0 to disable)' cand --timeout 'Request timeout (0 to disable)' cand -T 'Transfer timeout (0 to disable)' cand --transfer-timeout 'Transfer timeout (0 to disable)' cand -A 'Server API version to use, ''-'' to lookup' cand --api 'Server API version to use, ''-'' to lookup' cand --basic-auth 'Protected proxy HTTP basic authentication credentials (not FxA)' cand -H 'Use the specified history file' cand --history 'Use the specified history file' cand -h 'Prints help information' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' cand -f 'Force the action, ignore warnings' cand --force 'Force the action, ignore warnings' cand -I 'Not interactive, do not prompt' cand --no-interact 'Not interactive, do not prompt' cand -y 'Assume yes for prompts' cand --yes 'Assume yes for prompts' cand -q 'Produce output suitable for logging and automation' cand --quiet 'Produce output suitable for logging and automation' cand -v 'Enable verbose information and logging' cand --verbose 'Enable verbose information and logging' cand -i 'Don''t update local history for actions' cand --incognito 'Don''t update local history for actions' } &'ffsend;generate;help'= { cand -t 'Request timeout (0 to disable)' cand --timeout 'Request timeout (0 to disable)' cand -T 'Transfer timeout (0 to disable)' cand --transfer-timeout 'Transfer timeout (0 to disable)' cand -A 'Server API version to use, ''-'' to lookup' cand --api 'Server API version to use, ''-'' to lookup' cand --basic-auth 'Protected proxy HTTP basic authentication credentials (not FxA)' cand -H 'Use the specified history file' cand --history 'Use the specified history file' cand -h 'Prints help information' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' cand -f 'Force the action, ignore warnings' cand --force 'Force the action, ignore warnings' cand -I 'Not interactive, do not prompt' cand --no-interact 'Not interactive, do not prompt' cand -y 'Assume yes for prompts' cand --yes 'Assume yes for prompts' cand -q 'Produce output suitable for logging and automation' cand --quiet 'Produce output suitable for logging and automation' cand -v 'Enable verbose information and logging' cand --verbose 'Enable verbose information and logging' cand -i 'Don''t update local history for actions' cand --incognito 'Don''t update local history for actions' } &'ffsend;info'= { cand -o 'Specify the file owner token' cand --owner 'Specify the file owner token' cand -p 'Unlock a password protected file' cand --password 'Unlock a password protected file' cand -t 'Request timeout (0 to disable)' cand --timeout 'Request timeout (0 to disable)' cand -T 'Transfer timeout (0 to disable)' cand --transfer-timeout 'Transfer timeout (0 to disable)' cand -A 'Server API version to use, ''-'' to lookup' cand --api 'Server API version to use, ''-'' to lookup' cand --basic-auth 'Protected proxy HTTP basic authentication credentials (not FxA)' cand -H 'Use the specified history file' cand --history 'Use the specified history file' cand -h 'Prints help information' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' cand -f 'Force the action, ignore warnings' cand --force 'Force the action, ignore warnings' cand -I 'Not interactive, do not prompt' cand --no-interact 'Not interactive, do not prompt' cand -y 'Assume yes for prompts' cand --yes 'Assume yes for prompts' cand -q 'Produce output suitable for logging and automation' cand --quiet 'Produce output suitable for logging and automation' cand -v 'Enable verbose information and logging' cand --verbose 'Enable verbose information and logging' cand -i 'Don''t update local history for actions' cand --incognito 'Don''t update local history for actions' } &'ffsend;parameters'= { cand -o 'Specify the file owner token' cand --owner 'Specify the file owner token' cand -d 'The file download limit' cand --download-limit 'The file download limit' cand -t 'Request timeout (0 to disable)' cand --timeout 'Request timeout (0 to disable)' cand -T 'Transfer timeout (0 to disable)' cand --transfer-timeout 'Transfer timeout (0 to disable)' cand -A 'Server API version to use, ''-'' to lookup' cand --api 'Server API version to use, ''-'' to lookup' cand --basic-auth 'Protected proxy HTTP basic authentication credentials (not FxA)' cand -H 'Use the specified history file' cand --history 'Use the specified history file' cand -h 'Prints help information' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' cand -f 'Force the action, ignore warnings' cand --force 'Force the action, ignore warnings' cand -I 'Not interactive, do not prompt' cand --no-interact 'Not interactive, do not prompt' cand -y 'Assume yes for prompts' cand --yes 'Assume yes for prompts' cand -q 'Produce output suitable for logging and automation' cand --quiet 'Produce output suitable for logging and automation' cand -v 'Enable verbose information and logging' cand --verbose 'Enable verbose information and logging' cand -i 'Don''t update local history for actions' cand --incognito 'Don''t update local history for actions' } &'ffsend;password'= { cand -p 'Specify a password, do not prompt' cand --password 'Specify a password, do not prompt' cand -o 'Specify the file owner token' cand --owner 'Specify the file owner token' cand -t 'Request timeout (0 to disable)' cand --timeout 'Request timeout (0 to disable)' cand -T 'Transfer timeout (0 to disable)' cand --transfer-timeout 'Transfer timeout (0 to disable)' cand -A 'Server API version to use, ''-'' to lookup' cand --api 'Server API version to use, ''-'' to lookup' cand --basic-auth 'Protected proxy HTTP basic authentication credentials (not FxA)' cand -H 'Use the specified history file' cand --history 'Use the specified history file' cand -P 'Protect the file with a generated passphrase' cand --gen-passphrase 'Protect the file with a generated passphrase' cand -h 'Prints help information' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' cand -f 'Force the action, ignore warnings' cand --force 'Force the action, ignore warnings' cand -I 'Not interactive, do not prompt' cand --no-interact 'Not interactive, do not prompt' cand -y 'Assume yes for prompts' cand --yes 'Assume yes for prompts' cand -q 'Produce output suitable for logging and automation' cand --quiet 'Produce output suitable for logging and automation' cand -v 'Enable verbose information and logging' cand --verbose 'Enable verbose information and logging' cand -i 'Don''t update local history for actions' cand --incognito 'Don''t update local history for actions' } &'ffsend;upload'= { cand -p 'Protect the file with a password' cand --password 'Protect the file with a password' cand -d 'The file download limit' cand --download-limit 'The file download limit' cand -e 'The file expiry time' cand --expiry-time 'The file expiry time' cand -h 'The remote host to upload to' cand --host 'The remote host to upload to' cand -n 'Rename the file being uploaded' cand --name 'Rename the file being uploaded' cand -t 'Request timeout (0 to disable)' cand --timeout 'Request timeout (0 to disable)' cand -T 'Transfer timeout (0 to disable)' cand --transfer-timeout 'Transfer timeout (0 to disable)' cand -A 'Server API version to use, ''-'' to lookup' cand --api 'Server API version to use, ''-'' to lookup' cand --basic-auth 'Protected proxy HTTP basic authentication credentials (not FxA)' cand -H 'Use the specified history file' cand --history 'Use the specified history file' cand -P 'Protect the file with a generated passphrase' cand --gen-passphrase 'Protect the file with a generated passphrase' cand -o 'Open the share link in your browser' cand --open 'Open the share link in your browser' cand -D 'Delete local file after upload' cand --delete 'Delete local file after upload' cand -a 'Archive the upload in a single file' cand --archive 'Archive the upload in a single file' cand -c 'Copy the share link to your clipboard' cand --copy 'Copy the share link to your clipboard' cand -C 'Copy the ffsend download command to your clipboard' cand --copy-cmd 'Copy the ffsend download command to your clipboard' cand -S 'Shorten share URLs with a public service' cand --shorten 'Shorten share URLs with a public service' cand -Q 'Print a QR code for the share URL' cand --qrcode 'Print a QR code for the share URL' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' cand -f 'Force the action, ignore warnings' cand --force 'Force the action, ignore warnings' cand -I 'Not interactive, do not prompt' cand --no-interact 'Not interactive, do not prompt' cand -y 'Assume yes for prompts' cand --yes 'Assume yes for prompts' cand -q 'Produce output suitable for logging and automation' cand --quiet 'Produce output suitable for logging and automation' cand -v 'Enable verbose information and logging' cand --verbose 'Enable verbose information and logging' cand -i 'Don''t update local history for actions' cand --incognito 'Don''t update local history for actions' } &'ffsend;version'= { cand -h 'The remote host to upload to' cand --host 'The remote host to upload to' cand -t 'Request timeout (0 to disable)' cand --timeout 'Request timeout (0 to disable)' cand -T 'Transfer timeout (0 to disable)' cand --transfer-timeout 'Transfer timeout (0 to disable)' cand -A 'Server API version to use, ''-'' to lookup' cand --api 'Server API version to use, ''-'' to lookup' cand --basic-auth 'Protected proxy HTTP basic authentication credentials (not FxA)' cand -H 'Use the specified history file' cand --history 'Use the specified history file' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' cand -f 'Force the action, ignore warnings' cand --force 'Force the action, ignore warnings' cand -I 'Not interactive, do not prompt' cand --no-interact 'Not interactive, do not prompt' cand -y 'Assume yes for prompts' cand --yes 'Assume yes for prompts' cand -q 'Produce output suitable for logging and automation' cand --quiet 'Produce output suitable for logging and automation' cand -v 'Enable verbose information and logging' cand --verbose 'Enable verbose information and logging' cand -i 'Don''t update local history for actions' cand --incognito 'Don''t update local history for actions' } &'ffsend;history'= { cand -R 'Remove history entry' cand --rm 'Remove history entry' cand -t 'Request timeout (0 to disable)' cand --timeout 'Request timeout (0 to disable)' cand -T 'Transfer timeout (0 to disable)' cand --transfer-timeout 'Transfer timeout (0 to disable)' cand -A 'Server API version to use, ''-'' to lookup' cand --api 'Server API version to use, ''-'' to lookup' cand --basic-auth 'Protected proxy HTTP basic authentication credentials (not FxA)' cand -H 'Use the specified history file' cand --history 'Use the specified history file' cand -C 'Clear all history' cand --clear 'Clear all history' cand -h 'Prints help information' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' cand -f 'Force the action, ignore warnings' cand --force 'Force the action, ignore warnings' cand -I 'Not interactive, do not prompt' cand --no-interact 'Not interactive, do not prompt' cand -y 'Assume yes for prompts' cand --yes 'Assume yes for prompts' cand -q 'Produce output suitable for logging and automation' cand --quiet 'Produce output suitable for logging and automation' cand -v 'Enable verbose information and logging' cand --verbose 'Enable verbose information and logging' cand -i 'Don''t update local history for actions' cand --incognito 'Don''t update local history for actions' } &'ffsend;help'= { cand -t 'Request timeout (0 to disable)' cand --timeout 'Request timeout (0 to disable)' cand -T 'Transfer timeout (0 to disable)' cand --transfer-timeout 'Transfer timeout (0 to disable)' cand -A 'Server API version to use, ''-'' to lookup' cand --api 'Server API version to use, ''-'' to lookup' cand --basic-auth 'Protected proxy HTTP basic authentication credentials (not FxA)' cand -H 'Use the specified history file' cand --history 'Use the specified history file' cand -h 'Prints help information' cand --help 'Prints help information' cand -V 'Prints version information' cand --version 'Prints version information' cand -f 'Force the action, ignore warnings' cand --force 'Force the action, ignore warnings' cand -I 'Not interactive, do not prompt' cand --no-interact 'Not interactive, do not prompt' cand -y 'Assume yes for prompts' cand --yes 'Assume yes for prompts' cand -q 'Produce output suitable for logging and automation' cand --quiet 'Produce output suitable for logging and automation' cand -v 'Enable verbose information and logging' cand --verbose 'Enable verbose information and logging' cand -i 'Don''t update local history for actions' cand --incognito 'Don''t update local history for actions' } ] $completions[$command] } ================================================ FILE: contrib/completions/ffsend.fish ================================================ complete -c ffsend -n "__fish_use_subcommand" -s t -l timeout -d 'Request timeout (0 to disable)' complete -c ffsend -n "__fish_use_subcommand" -s T -l transfer-timeout -d 'Transfer timeout (0 to disable)' complete -c ffsend -n "__fish_use_subcommand" -s A -l api -d 'Server API version to use, \'-\' to lookup' complete -c ffsend -n "__fish_use_subcommand" -l basic-auth -d 'Protected proxy HTTP basic authentication credentials (not FxA)' complete -c ffsend -n "__fish_use_subcommand" -s H -l history -d 'Use the specified history file' complete -c ffsend -n "__fish_use_subcommand" -s f -l force -d 'Force the action, ignore warnings' complete -c ffsend -n "__fish_use_subcommand" -s I -l no-interact -d 'Not interactive, do not prompt' complete -c ffsend -n "__fish_use_subcommand" -s y -l yes -d 'Assume yes for prompts' complete -c ffsend -n "__fish_use_subcommand" -s q -l quiet -d 'Produce output suitable for logging and automation' complete -c ffsend -n "__fish_use_subcommand" -s v -l verbose -d 'Enable verbose information and logging' complete -c ffsend -n "__fish_use_subcommand" -s i -l incognito -d 'Don\'t update local history for actions' complete -c ffsend -n "__fish_use_subcommand" -s h -l help -d 'Prints help information' complete -c ffsend -n "__fish_use_subcommand" -s V -l version -d 'Prints version information' complete -c ffsend -n "__fish_use_subcommand" -f -a "debug" -d 'View debug information' complete -c ffsend -n "__fish_use_subcommand" -f -a "delete" -d 'Delete a shared file' complete -c ffsend -n "__fish_use_subcommand" -f -a "download" -d 'Download files' complete -c ffsend -n "__fish_use_subcommand" -f -a "exists" -d 'Check whether a remote file exists' complete -c ffsend -n "__fish_use_subcommand" -f -a "generate" -d 'Generate assets' complete -c ffsend -n "__fish_use_subcommand" -f -a "info" -d 'Fetch info about a shared file' complete -c ffsend -n "__fish_use_subcommand" -f -a "parameters" -d 'Change parameters of a shared file' complete -c ffsend -n "__fish_use_subcommand" -f -a "password" -d 'Change the password of a shared file' complete -c ffsend -n "__fish_use_subcommand" -f -a "upload" -d 'Upload files' complete -c ffsend -n "__fish_use_subcommand" -f -a "version" -d 'Determine the Send server version' complete -c ffsend -n "__fish_use_subcommand" -f -a "history" -d 'View file history' complete -c ffsend -n "__fish_use_subcommand" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)' complete -c ffsend -n "__fish_seen_subcommand_from debug" -s h -l host -d 'The remote host to upload to' complete -c ffsend -n "__fish_seen_subcommand_from debug" -s t -l timeout -d 'Request timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from debug" -s T -l transfer-timeout -d 'Transfer timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from debug" -s A -l api -d 'Server API version to use, \'-\' to lookup' complete -c ffsend -n "__fish_seen_subcommand_from debug" -l basic-auth -d 'Protected proxy HTTP basic authentication credentials (not FxA)' complete -c ffsend -n "__fish_seen_subcommand_from debug" -s H -l history -d 'Use the specified history file' complete -c ffsend -n "__fish_seen_subcommand_from debug" -l help -d 'Prints help information' complete -c ffsend -n "__fish_seen_subcommand_from debug" -s V -l version -d 'Prints version information' complete -c ffsend -n "__fish_seen_subcommand_from debug" -s f -l force -d 'Force the action, ignore warnings' complete -c ffsend -n "__fish_seen_subcommand_from debug" -s I -l no-interact -d 'Not interactive, do not prompt' complete -c ffsend -n "__fish_seen_subcommand_from debug" -s y -l yes -d 'Assume yes for prompts' complete -c ffsend -n "__fish_seen_subcommand_from debug" -s q -l quiet -d 'Produce output suitable for logging and automation' complete -c ffsend -n "__fish_seen_subcommand_from debug" -s v -l verbose -d 'Enable verbose information and logging' complete -c ffsend -n "__fish_seen_subcommand_from debug" -s i -l incognito -d 'Don\'t update local history for actions' complete -c ffsend -n "__fish_seen_subcommand_from delete" -s o -l owner -d 'Specify the file owner token' complete -c ffsend -n "__fish_seen_subcommand_from delete" -s t -l timeout -d 'Request timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from delete" -s T -l transfer-timeout -d 'Transfer timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from delete" -s A -l api -d 'Server API version to use, \'-\' to lookup' complete -c ffsend -n "__fish_seen_subcommand_from delete" -l basic-auth -d 'Protected proxy HTTP basic authentication credentials (not FxA)' complete -c ffsend -n "__fish_seen_subcommand_from delete" -s H -l history -d 'Use the specified history file' complete -c ffsend -n "__fish_seen_subcommand_from delete" -s h -l help -d 'Prints help information' complete -c ffsend -n "__fish_seen_subcommand_from delete" -s V -l version -d 'Prints version information' complete -c ffsend -n "__fish_seen_subcommand_from delete" -s f -l force -d 'Force the action, ignore warnings' complete -c ffsend -n "__fish_seen_subcommand_from delete" -s I -l no-interact -d 'Not interactive, do not prompt' complete -c ffsend -n "__fish_seen_subcommand_from delete" -s y -l yes -d 'Assume yes for prompts' complete -c ffsend -n "__fish_seen_subcommand_from delete" -s q -l quiet -d 'Produce output suitable for logging and automation' complete -c ffsend -n "__fish_seen_subcommand_from delete" -s v -l verbose -d 'Enable verbose information and logging' complete -c ffsend -n "__fish_seen_subcommand_from delete" -s i -l incognito -d 'Don\'t update local history for actions' complete -c ffsend -n "__fish_seen_subcommand_from download" -s p -l password -d 'Unlock a password protected file' complete -c ffsend -n "__fish_seen_subcommand_from download" -s o -l output -d 'Output file or directory' complete -c ffsend -n "__fish_seen_subcommand_from download" -s t -l timeout -d 'Request timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from download" -s T -l transfer-timeout -d 'Transfer timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from download" -s A -l api -d 'Server API version to use, \'-\' to lookup' complete -c ffsend -n "__fish_seen_subcommand_from download" -l basic-auth -d 'Protected proxy HTTP basic authentication credentials (not FxA)' complete -c ffsend -n "__fish_seen_subcommand_from download" -s H -l history -d 'Use the specified history file' complete -c ffsend -n "__fish_seen_subcommand_from download" -s e -l extract -d 'Extract an archived file' complete -c ffsend -n "__fish_seen_subcommand_from download" -s h -l help -d 'Prints help information' complete -c ffsend -n "__fish_seen_subcommand_from download" -s V -l version -d 'Prints version information' complete -c ffsend -n "__fish_seen_subcommand_from download" -s f -l force -d 'Force the action, ignore warnings' complete -c ffsend -n "__fish_seen_subcommand_from download" -s I -l no-interact -d 'Not interactive, do not prompt' complete -c ffsend -n "__fish_seen_subcommand_from download" -s y -l yes -d 'Assume yes for prompts' complete -c ffsend -n "__fish_seen_subcommand_from download" -s q -l quiet -d 'Produce output suitable for logging and automation' complete -c ffsend -n "__fish_seen_subcommand_from download" -s v -l verbose -d 'Enable verbose information and logging' complete -c ffsend -n "__fish_seen_subcommand_from download" -s i -l incognito -d 'Don\'t update local history for actions' complete -c ffsend -n "__fish_seen_subcommand_from exists" -s t -l timeout -d 'Request timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from exists" -s T -l transfer-timeout -d 'Transfer timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from exists" -s A -l api -d 'Server API version to use, \'-\' to lookup' complete -c ffsend -n "__fish_seen_subcommand_from exists" -l basic-auth -d 'Protected proxy HTTP basic authentication credentials (not FxA)' complete -c ffsend -n "__fish_seen_subcommand_from exists" -s H -l history -d 'Use the specified history file' complete -c ffsend -n "__fish_seen_subcommand_from exists" -s h -l help -d 'Prints help information' complete -c ffsend -n "__fish_seen_subcommand_from exists" -s V -l version -d 'Prints version information' complete -c ffsend -n "__fish_seen_subcommand_from exists" -s f -l force -d 'Force the action, ignore warnings' complete -c ffsend -n "__fish_seen_subcommand_from exists" -s I -l no-interact -d 'Not interactive, do not prompt' complete -c ffsend -n "__fish_seen_subcommand_from exists" -s y -l yes -d 'Assume yes for prompts' complete -c ffsend -n "__fish_seen_subcommand_from exists" -s q -l quiet -d 'Produce output suitable for logging and automation' complete -c ffsend -n "__fish_seen_subcommand_from exists" -s v -l verbose -d 'Enable verbose information and logging' complete -c ffsend -n "__fish_seen_subcommand_from exists" -s i -l incognito -d 'Don\'t update local history for actions' complete -c ffsend -n "__fish_seen_subcommand_from generate" -s t -l timeout -d 'Request timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from generate" -s T -l transfer-timeout -d 'Transfer timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from generate" -s A -l api -d 'Server API version to use, \'-\' to lookup' complete -c ffsend -n "__fish_seen_subcommand_from generate" -l basic-auth -d 'Protected proxy HTTP basic authentication credentials (not FxA)' complete -c ffsend -n "__fish_seen_subcommand_from generate" -s H -l history -d 'Use the specified history file' complete -c ffsend -n "__fish_seen_subcommand_from generate" -s h -l help -d 'Prints help information' complete -c ffsend -n "__fish_seen_subcommand_from generate" -s V -l version -d 'Prints version information' complete -c ffsend -n "__fish_seen_subcommand_from generate" -s f -l force -d 'Force the action, ignore warnings' complete -c ffsend -n "__fish_seen_subcommand_from generate" -s I -l no-interact -d 'Not interactive, do not prompt' complete -c ffsend -n "__fish_seen_subcommand_from generate" -s y -l yes -d 'Assume yes for prompts' complete -c ffsend -n "__fish_seen_subcommand_from generate" -s q -l quiet -d 'Produce output suitable for logging and automation' complete -c ffsend -n "__fish_seen_subcommand_from generate" -s v -l verbose -d 'Enable verbose information and logging' complete -c ffsend -n "__fish_seen_subcommand_from generate" -s i -l incognito -d 'Don\'t update local history for actions' complete -c ffsend -n "__fish_seen_subcommand_from generate" -f -a "completions" -d 'Shell completions' complete -c ffsend -n "__fish_seen_subcommand_from generate" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)' complete -c ffsend -n "__fish_seen_subcommand_from completions" -s o -l output -d 'Shell completion files output directory' complete -c ffsend -n "__fish_seen_subcommand_from completions" -s t -l timeout -d 'Request timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from completions" -s T -l transfer-timeout -d 'Transfer timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from completions" -s A -l api -d 'Server API version to use, \'-\' to lookup' complete -c ffsend -n "__fish_seen_subcommand_from completions" -l basic-auth -d 'Protected proxy HTTP basic authentication credentials (not FxA)' complete -c ffsend -n "__fish_seen_subcommand_from completions" -s H -l history -d 'Use the specified history file' complete -c ffsend -n "__fish_seen_subcommand_from completions" -s h -l help -d 'Prints help information' complete -c ffsend -n "__fish_seen_subcommand_from completions" -s V -l version -d 'Prints version information' complete -c ffsend -n "__fish_seen_subcommand_from completions" -s f -l force -d 'Force the action, ignore warnings' complete -c ffsend -n "__fish_seen_subcommand_from completions" -s I -l no-interact -d 'Not interactive, do not prompt' complete -c ffsend -n "__fish_seen_subcommand_from completions" -s y -l yes -d 'Assume yes for prompts' complete -c ffsend -n "__fish_seen_subcommand_from completions" -s q -l quiet -d 'Produce output suitable for logging and automation' complete -c ffsend -n "__fish_seen_subcommand_from completions" -s v -l verbose -d 'Enable verbose information and logging' complete -c ffsend -n "__fish_seen_subcommand_from completions" -s i -l incognito -d 'Don\'t update local history for actions' complete -c ffsend -n "__fish_seen_subcommand_from help" -s t -l timeout -d 'Request timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from help" -s T -l transfer-timeout -d 'Transfer timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from help" -s A -l api -d 'Server API version to use, \'-\' to lookup' complete -c ffsend -n "__fish_seen_subcommand_from help" -l basic-auth -d 'Protected proxy HTTP basic authentication credentials (not FxA)' complete -c ffsend -n "__fish_seen_subcommand_from help" -s H -l history -d 'Use the specified history file' complete -c ffsend -n "__fish_seen_subcommand_from help" -s h -l help -d 'Prints help information' complete -c ffsend -n "__fish_seen_subcommand_from help" -s V -l version -d 'Prints version information' complete -c ffsend -n "__fish_seen_subcommand_from help" -s f -l force -d 'Force the action, ignore warnings' complete -c ffsend -n "__fish_seen_subcommand_from help" -s I -l no-interact -d 'Not interactive, do not prompt' complete -c ffsend -n "__fish_seen_subcommand_from help" -s y -l yes -d 'Assume yes for prompts' complete -c ffsend -n "__fish_seen_subcommand_from help" -s q -l quiet -d 'Produce output suitable for logging and automation' complete -c ffsend -n "__fish_seen_subcommand_from help" -s v -l verbose -d 'Enable verbose information and logging' complete -c ffsend -n "__fish_seen_subcommand_from help" -s i -l incognito -d 'Don\'t update local history for actions' complete -c ffsend -n "__fish_seen_subcommand_from info" -s o -l owner -d 'Specify the file owner token' complete -c ffsend -n "__fish_seen_subcommand_from info" -s p -l password -d 'Unlock a password protected file' complete -c ffsend -n "__fish_seen_subcommand_from info" -s t -l timeout -d 'Request timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from info" -s T -l transfer-timeout -d 'Transfer timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from info" -s A -l api -d 'Server API version to use, \'-\' to lookup' complete -c ffsend -n "__fish_seen_subcommand_from info" -l basic-auth -d 'Protected proxy HTTP basic authentication credentials (not FxA)' complete -c ffsend -n "__fish_seen_subcommand_from info" -s H -l history -d 'Use the specified history file' complete -c ffsend -n "__fish_seen_subcommand_from info" -s h -l help -d 'Prints help information' complete -c ffsend -n "__fish_seen_subcommand_from info" -s V -l version -d 'Prints version information' complete -c ffsend -n "__fish_seen_subcommand_from info" -s f -l force -d 'Force the action, ignore warnings' complete -c ffsend -n "__fish_seen_subcommand_from info" -s I -l no-interact -d 'Not interactive, do not prompt' complete -c ffsend -n "__fish_seen_subcommand_from info" -s y -l yes -d 'Assume yes for prompts' complete -c ffsend -n "__fish_seen_subcommand_from info" -s q -l quiet -d 'Produce output suitable for logging and automation' complete -c ffsend -n "__fish_seen_subcommand_from info" -s v -l verbose -d 'Enable verbose information and logging' complete -c ffsend -n "__fish_seen_subcommand_from info" -s i -l incognito -d 'Don\'t update local history for actions' complete -c ffsend -n "__fish_seen_subcommand_from parameters" -s o -l owner -d 'Specify the file owner token' complete -c ffsend -n "__fish_seen_subcommand_from parameters" -s d -l download-limit -d 'The file download limit' complete -c ffsend -n "__fish_seen_subcommand_from parameters" -s t -l timeout -d 'Request timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from parameters" -s T -l transfer-timeout -d 'Transfer timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from parameters" -s A -l api -d 'Server API version to use, \'-\' to lookup' complete -c ffsend -n "__fish_seen_subcommand_from parameters" -l basic-auth -d 'Protected proxy HTTP basic authentication credentials (not FxA)' complete -c ffsend -n "__fish_seen_subcommand_from parameters" -s H -l history -d 'Use the specified history file' complete -c ffsend -n "__fish_seen_subcommand_from parameters" -s h -l help -d 'Prints help information' complete -c ffsend -n "__fish_seen_subcommand_from parameters" -s V -l version -d 'Prints version information' complete -c ffsend -n "__fish_seen_subcommand_from parameters" -s f -l force -d 'Force the action, ignore warnings' complete -c ffsend -n "__fish_seen_subcommand_from parameters" -s I -l no-interact -d 'Not interactive, do not prompt' complete -c ffsend -n "__fish_seen_subcommand_from parameters" -s y -l yes -d 'Assume yes for prompts' complete -c ffsend -n "__fish_seen_subcommand_from parameters" -s q -l quiet -d 'Produce output suitable for logging and automation' complete -c ffsend -n "__fish_seen_subcommand_from parameters" -s v -l verbose -d 'Enable verbose information and logging' complete -c ffsend -n "__fish_seen_subcommand_from parameters" -s i -l incognito -d 'Don\'t update local history for actions' complete -c ffsend -n "__fish_seen_subcommand_from password" -s p -l password -d 'Specify a password, do not prompt' complete -c ffsend -n "__fish_seen_subcommand_from password" -s o -l owner -d 'Specify the file owner token' complete -c ffsend -n "__fish_seen_subcommand_from password" -s t -l timeout -d 'Request timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from password" -s T -l transfer-timeout -d 'Transfer timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from password" -s A -l api -d 'Server API version to use, \'-\' to lookup' complete -c ffsend -n "__fish_seen_subcommand_from password" -l basic-auth -d 'Protected proxy HTTP basic authentication credentials (not FxA)' complete -c ffsend -n "__fish_seen_subcommand_from password" -s H -l history -d 'Use the specified history file' complete -c ffsend -n "__fish_seen_subcommand_from password" -s P -l gen-passphrase -d 'Protect the file with a generated passphrase' complete -c ffsend -n "__fish_seen_subcommand_from password" -s h -l help -d 'Prints help information' complete -c ffsend -n "__fish_seen_subcommand_from password" -s V -l version -d 'Prints version information' complete -c ffsend -n "__fish_seen_subcommand_from password" -s f -l force -d 'Force the action, ignore warnings' complete -c ffsend -n "__fish_seen_subcommand_from password" -s I -l no-interact -d 'Not interactive, do not prompt' complete -c ffsend -n "__fish_seen_subcommand_from password" -s y -l yes -d 'Assume yes for prompts' complete -c ffsend -n "__fish_seen_subcommand_from password" -s q -l quiet -d 'Produce output suitable for logging and automation' complete -c ffsend -n "__fish_seen_subcommand_from password" -s v -l verbose -d 'Enable verbose information and logging' complete -c ffsend -n "__fish_seen_subcommand_from password" -s i -l incognito -d 'Don\'t update local history for actions' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s p -l password -d 'Protect the file with a password' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s d -l download-limit -d 'The file download limit' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s e -l expiry-time -d 'The file expiry time' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s h -l host -d 'The remote host to upload to' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s n -l name -d 'Rename the file being uploaded' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s t -l timeout -d 'Request timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s T -l transfer-timeout -d 'Transfer timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s A -l api -d 'Server API version to use, \'-\' to lookup' complete -c ffsend -n "__fish_seen_subcommand_from upload" -l basic-auth -d 'Protected proxy HTTP basic authentication credentials (not FxA)' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s H -l history -d 'Use the specified history file' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s P -l gen-passphrase -d 'Protect the file with a generated passphrase' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s o -l open -d 'Open the share link in your browser' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s D -l delete -d 'Delete local file after upload' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s a -l archive -d 'Archive the upload in a single file' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s c -l copy -d 'Copy the share link to your clipboard' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s C -l copy-cmd -d 'Copy the ffsend download command to your clipboard' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s S -l shorten -d 'Shorten share URLs with a public service' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s Q -l qrcode -d 'Print a QR code for the share URL' complete -c ffsend -n "__fish_seen_subcommand_from upload" -l help -d 'Prints help information' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s V -l version -d 'Prints version information' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s f -l force -d 'Force the action, ignore warnings' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s I -l no-interact -d 'Not interactive, do not prompt' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s y -l yes -d 'Assume yes for prompts' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s q -l quiet -d 'Produce output suitable for logging and automation' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s v -l verbose -d 'Enable verbose information and logging' complete -c ffsend -n "__fish_seen_subcommand_from upload" -s i -l incognito -d 'Don\'t update local history for actions' complete -c ffsend -n "__fish_seen_subcommand_from version" -s h -l host -d 'The remote host to upload to' complete -c ffsend -n "__fish_seen_subcommand_from version" -s t -l timeout -d 'Request timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from version" -s T -l transfer-timeout -d 'Transfer timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from version" -s A -l api -d 'Server API version to use, \'-\' to lookup' complete -c ffsend -n "__fish_seen_subcommand_from version" -l basic-auth -d 'Protected proxy HTTP basic authentication credentials (not FxA)' complete -c ffsend -n "__fish_seen_subcommand_from version" -s H -l history -d 'Use the specified history file' complete -c ffsend -n "__fish_seen_subcommand_from version" -l help -d 'Prints help information' complete -c ffsend -n "__fish_seen_subcommand_from version" -s V -l version -d 'Prints version information' complete -c ffsend -n "__fish_seen_subcommand_from version" -s f -l force -d 'Force the action, ignore warnings' complete -c ffsend -n "__fish_seen_subcommand_from version" -s I -l no-interact -d 'Not interactive, do not prompt' complete -c ffsend -n "__fish_seen_subcommand_from version" -s y -l yes -d 'Assume yes for prompts' complete -c ffsend -n "__fish_seen_subcommand_from version" -s q -l quiet -d 'Produce output suitable for logging and automation' complete -c ffsend -n "__fish_seen_subcommand_from version" -s v -l verbose -d 'Enable verbose information and logging' complete -c ffsend -n "__fish_seen_subcommand_from version" -s i -l incognito -d 'Don\'t update local history for actions' complete -c ffsend -n "__fish_seen_subcommand_from history" -s R -l rm -d 'Remove history entry' complete -c ffsend -n "__fish_seen_subcommand_from history" -s t -l timeout -d 'Request timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from history" -s T -l transfer-timeout -d 'Transfer timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from history" -s A -l api -d 'Server API version to use, \'-\' to lookup' complete -c ffsend -n "__fish_seen_subcommand_from history" -l basic-auth -d 'Protected proxy HTTP basic authentication credentials (not FxA)' complete -c ffsend -n "__fish_seen_subcommand_from history" -s H -l history -d 'Use the specified history file' complete -c ffsend -n "__fish_seen_subcommand_from history" -s C -l clear -d 'Clear all history' complete -c ffsend -n "__fish_seen_subcommand_from history" -s h -l help -d 'Prints help information' complete -c ffsend -n "__fish_seen_subcommand_from history" -s V -l version -d 'Prints version information' complete -c ffsend -n "__fish_seen_subcommand_from history" -s f -l force -d 'Force the action, ignore warnings' complete -c ffsend -n "__fish_seen_subcommand_from history" -s I -l no-interact -d 'Not interactive, do not prompt' complete -c ffsend -n "__fish_seen_subcommand_from history" -s y -l yes -d 'Assume yes for prompts' complete -c ffsend -n "__fish_seen_subcommand_from history" -s q -l quiet -d 'Produce output suitable for logging and automation' complete -c ffsend -n "__fish_seen_subcommand_from history" -s v -l verbose -d 'Enable verbose information and logging' complete -c ffsend -n "__fish_seen_subcommand_from history" -s i -l incognito -d 'Don\'t update local history for actions' complete -c ffsend -n "__fish_seen_subcommand_from help" -s t -l timeout -d 'Request timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from help" -s T -l transfer-timeout -d 'Transfer timeout (0 to disable)' complete -c ffsend -n "__fish_seen_subcommand_from help" -s A -l api -d 'Server API version to use, \'-\' to lookup' complete -c ffsend -n "__fish_seen_subcommand_from help" -l basic-auth -d 'Protected proxy HTTP basic authentication credentials (not FxA)' complete -c ffsend -n "__fish_seen_subcommand_from help" -s H -l history -d 'Use the specified history file' complete -c ffsend -n "__fish_seen_subcommand_from help" -s h -l help -d 'Prints help information' complete -c ffsend -n "__fish_seen_subcommand_from help" -s V -l version -d 'Prints version information' complete -c ffsend -n "__fish_seen_subcommand_from help" -s f -l force -d 'Force the action, ignore warnings' complete -c ffsend -n "__fish_seen_subcommand_from help" -s I -l no-interact -d 'Not interactive, do not prompt' complete -c ffsend -n "__fish_seen_subcommand_from help" -s y -l yes -d 'Assume yes for prompts' complete -c ffsend -n "__fish_seen_subcommand_from help" -s q -l quiet -d 'Produce output suitable for logging and automation' complete -c ffsend -n "__fish_seen_subcommand_from help" -s v -l verbose -d 'Enable verbose information and logging' complete -c ffsend -n "__fish_seen_subcommand_from help" -s i -l incognito -d 'Don\'t update local history for actions' ================================================ FILE: contrib/completions/gen_completions ================================================ #!/usr/bin/env bash # Stop on error set -e echo "Generating all completions using cargo debug binary..." cargo run -q -- generate completions all --output "$PWD" echo "Done." ================================================ FILE: contrib/util/nautilus/README.md ================================================ `firefox-send` is a script for Nautilus/Nemo/Caja (maybe it needs some adaptation for Caja) to send files directly from the file browser, using the contextual menu. * Copy the `firefox-send` file to ~/.local/share/nautilus/scripts/firefox-send * Modify the default options to your use case: host server, download number, retention time. * Make the file executable (`chmod +x firefox-send`). * Restart Nautilus/Nemo/Caja. ================================================ FILE: contrib/util/nautilus/firefox-send ================================================ #!/bin/bash #CONSTANTS #FILEPATH=`echo $NAUTILUS_SCRIPT_SELECTED_URIS | sed 's@file://@@g'` # Quote the paths IFS=$'\n' read -d '' -r -a FILEPATH <<< "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" FFSEND_BIN='/usr/bin/ffsend' FFSEND_BIN_OPTS="upload --open --copy" ZENITY='/usr/bin/zenity ' ZENITY_PROGRESS_OPTIONS='--auto-close --auto-kill' #you can remove this if you like #sanity checks for sanity_check in $FFSEND_BIN "${FILEPATH[@]}" do ZENITY_ERROR_SANITY="There is an error, it involved $sanity_check.\n Probably binary or file missing" if [ ! -e $sanity_check ] then #zenity --error --text="$(eval "echo \"$ZENITY_ERROR_SANITY\"")" zenity --error --text="$ZENITY_ERROR_SANITY" exit fi done # Use the following flags automatically from now on # -I: no interaction # -f: force # -y: yes # -q: quiet export FFSEND_NO_INTERACT=1 FFSEND_FORCE=1 FFSEND_YES=1 FFSEND_QUIET=1 export FFSEND_HOST=https://send.boblorange.net export FFSEND_EXPIRY_TIME=604800 export FFSEND_DOWNLOAD_LIMIT=5 #check whether copying file or directory if [ ! -f "${FILEPATH[@]}" ]; then FFSEND_BIN_OPTS="$FFSEND_BIN_OPTS --archive" fi # Upload a file #zenity --info --text="Ready to send: $FFSEND_BIN $FFSEND_BIN_OPTS ${FILEPATH[@]}" $FFSEND_BIN $FFSEND_BIN_OPTS "${FILEPATH[@]}" | $($ZENITY --progress --text="sending $(basename $FILEPATH)" --pulsate $ZENITY_PROGRESS_OPTIONS) #echo -e "$FILEPATH" | xargs -i $FFSEND_BIN $FFSEND_BIN_OPTS {} | $($ZENITY --progress --text="sending $(basename $FILEPATH)" --pulsate $ZENITY_PROGRESS_OPTIONS) # Upload a file #echo -e "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | xargs -i ffsend upload --open --copy {} ================================================ FILE: pkg/alpine/APKBUILD ================================================ # Contributor: Rasmus Thomsen # Maintainer: Rasmus Thomsen pkgname=ffsend pkgver=0.2.62 pkgrel=0 pkgdesc=" A fully featured Send client" url="https://gitlab.com/timvisee/ffsend" arch="x86_64 x86 armhf armv7 aarch64 ppc64le" # limited by cargo license="GPL-3.0-only" makedepends="cargo openssl-dev" subpackages=" $pkgname-zsh-completion:zshcomp:noarch $pkgname-fish-completion:fishcomp:noarch $pkgname-bash-completion:bashcomp:noarch " source="https://gitlab.com/timvisee/ffsend/-/archive/v$pkgver/ffsend-v$pkgver.tar.gz" builddir="$srcdir/$pkgname-v$pkgver" case "$CARCH" in x86) export CFLAGS="$CFLAGS -fno-stack-protector" ;; esac build() { cargo build --release } check() { cargo test --release } package() { cargo install --path . --root="$pkgdir/usr" rm "$pkgdir"/usr/.crates.toml } bashcomp() { depends="" pkgdesc="Bash completions for $pkgname" install_if="$pkgname=$pkgver-r$pkgrel bash-completion" install -Dm644 "$builddir"/contrib/completions/ffsend.bash \ "$subpkgdir"/usr/share/bash-completion/completions/ffsend } zshcomp() { depends="" pkgdesc="Zsh compltions for $pkgname" install_if="$pkgname=$pkgver-r$pkgrel zsh" install -Dm644 "$builddir"/contrib/completions/_ffsend \ "$subpkgdir"/usr/share/zsh/site-functions/_ffsend } fishcomp() { depends="" pkgdesc="Fish completions for $pkgname" install_if="$pkgname=$pkgver-r$pkgrel fish" install -Dm644 "$builddir"/contrib/completions/ffsend.fish \ "$subpkgdir"/usr/share/fish/completions/ffsend.fish } sha512sums="97477f59a498f4805340647c50c139d70ddbabaebb49b4acbae595ed9987fa2941b8d4dfd2edf76264b2a500fa10ac10f8583938fb29013936d9c092fe7fe7f1 ffsend-v0.2.51.tar.gz" ================================================ FILE: pkg/aur/aur.pub ================================================ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDHfiNi+rOCPKGLB6v9uuYR6GkN6Zd+CdaRbV82A26AUzs48ZG0xZGXHsoRuZY/yCUhcrS2u9xZ16fsAxnyf1QCF1hZVABUYtNhL1eEbSbLNiG9vIWJzbRjgegN/yyiG9ZVhFfNqXtPeapvuM3H44a2XeeFJcvTOfj/alkVjypi/DY/+XpC1IlX+CARC/e0zXHa3KZohn+CfBj8kWZWQEr7+EtKT59pslNxuJPcDUw7sKYLcBBz00BT0vv3lntyvZI1rRsD7AvItOwSZPp6or78Tgp8+O0HvFpjrlNipPEqDPpETIPcjTIVAlvlPFK1J0Rpzud38YdoWGfPiM77k7L7 timvisee@aur ================================================ FILE: pkg/aur/ffsend/PKGBUILD ================================================ # Maintainer: Tim Visee # # This PKGBUILD is managed externally, and is automatically updated here: # - https://gitlab.com/timvisee/ffsend/blob/master/pkg/aur/ffsend/PKGBUILD # - Mirror: https://github.com/timvisee/ffsend/blob/master/pkg/aur/ffsend/PKGBUILD pkgname=ffsend pkgver=0.0.0 # automatically set in CI, see: /.gitlab-ci.yml pkgrel=1 pkgdesc="Easily and securely share files from the command line. A Send client." url="https://gitlab.com/timvisee/ffsend" license=('GPL3') source=("$url/-/archive/v$pkgver/ffsend-v$pkgver.tar.gz") # automatically set in CI, see: /.gitlab-ci.yml sha256sums=('SKIP') # automatically set in CI, see: /.gitlab-ci.yml arch=('x86_64' 'i686') depends=('ca-certificates') makedepends=('cargo' 'cmake' 'openssl>=1.0') optdepends=('xclip: clipboard support') prepare() { cd "$pkgname-v$pkgver" cargo fetch --locked --target "$CARCH-unknown-linux-gnu" } build() { cd "$pkgname-v$pkgver" export RUSTUP_TOOLCHAIN=stable export CARGO_TARGET_DIR=target cargo build --frozen --release } check() { cd "$pkgname-v$pkgver" export RUSTUP_TOOLCHAIN=stable cargo test --frozen } package() { cd "$pkgname-v$pkgver" install -Dm0755 -t "$pkgdir/usr/bin/" "target/release/$pkgname" # Shell completions and LICENSE file install -Dm644 "contrib/completions/ffsend.bash" \ "$pkgdir/etc/bash_completion.d/ffsend" install -Dm644 "contrib/completions/_ffsend" \ "$pkgdir/usr/share/zsh/site-functions/_ffsend" install -Dm644 "contrib/completions/ffsend.fish" \ "$pkgdir/usr/share/fish/vendor_completions.d/ffsend.fish" install -Dm644 "LICENSE" \ "$pkgdir/usr/share/licenses/ffsend/LICENSE" } ================================================ FILE: pkg/aur/ffsend-bin/PKGBUILD ================================================ # Maintainer: Tim Visee # Contributor: Ariel AxionL # # This PKGBUILD is managed externally, and is automatically updated here: # - https://gitlab.com/timvisee/ffsend/blob/master/pkg/aur/ffsend-bin/PKGBUILD # - Mirror: https://github.com/timvisee/ffsend/blob/master/pkg/aur/ffsend-bin/PKGBUILD pkgname=ffsend-bin pkgver=0.0.0 # automatically set in CI, see: /.gitlab-ci.yml pkgrel=1 pkgdesc="Easily and securely share files from the command line. A Send client." url="https://gitlab.com/timvisee/ffsend" license=('GPL3') source=("ffsend-v$pkgver::https://github.com/timvisee/ffsend/releases/download/v$pkgver/ffsend-v$pkgver-linux-x64-static" "ffsend-v$pkgver.bash::https://raw.githubusercontent.com/timvisee/ffsend/v$pkgver/contrib/completions/ffsend.bash" "ffsend-v$pkgver.zsh::https://raw.githubusercontent.com/timvisee/ffsend/v$pkgver/contrib/completions/_ffsend" "ffsend-v$pkgver.fish::https://raw.githubusercontent.com/timvisee/ffsend/v$pkgver/contrib/completions/ffsend.fish" "LICENSE-v$pkgver::https://raw.githubusercontent.com/timvisee/ffsend/v$pkgver/LICENSE") # automatically set in CI, see: /.gitlab-ci.yml sha256sums=('SKIP') arch=('x86_64') provides=('ffsend') conflicts=('ffsend') depends=('ca-certificates') optdepends=('xclip: clipboard support' 'bash-completion: support auto completion for bash') package() { cd "$srcdir" install -Dm755 "ffsend-v$pkgver" "$pkgdir/usr/bin/ffsend" # Shell completions and LICENSE file install -Dm644 "ffsend-v$pkgver.bash" "$pkgdir/usr/share/bash-completion/completions/ffsend" install -Dm644 "ffsend-v$pkgver.zsh" "$pkgdir/usr/share/zsh/site-functions/_ffsend" install -Dm644 "ffsend-v$pkgver.fish" "$pkgdir/usr/share/fish/vendor_completions.d/ffsend.fish" install -Dm644 "LICENSE-v$pkgver" "$pkgdir/usr/share/licenses/ffsend/LICENSE" } ================================================ FILE: pkg/aur/ffsend-git/PKGBUILD ================================================ # Maintainer: Tim Visee # # This PKGBUILD is managed externally, and is automatically updated here: # - https://gitlab.com/timvisee/ffsend/blob/master/pkg/aur/ffsend-git/PKGBUILD # - Mirror: https://github.com/timvisee/ffsend/blob/master/pkg/aur/ffsend-git/PKGBUILD pkgname=ffsend-git pkgver=0.0.0 # automatically set in CI, see: /.gitlab-ci.yml pkgrel=1 pkgdesc="Easily and securely share files from the command line. A Send client." url="https://gitlab.com/timvisee/ffsend" license=('GPL3') source=("git+${url}") sha256sums=('SKIP') arch=('x86_64' 'i686') provides=('ffsend') conflicts=('ffsend') depends=('ca-certificates') makedepends=('cargo' 'cmake' 'openssl>=1.0') optdepends=('xclip: clipboard support') prepare() { cd "${pkgname%-git}" cargo fetch --locked --target "$CARCH-unknown-linux-gnu" } build() { cd "${pkgname%-git}" export RUSTUP_TOOLCHAIN=stable export CARGO_TARGET_DIR=target cargo build --frozen --release } check() { cd "${pkgname%-git}" export RUSTUP_TOOLCHAIN=stable cargo test --frozen } package() { cd "${pkgname%-git}" install -Dm0755 -t "$pkgdir/usr/bin/" "target/release/ffsend" # Shell completions and LICENSE file install -Dm644 "contrib/completions/ffsend.bash" \ "$pkgdir/etc/bash_completion.d/ffsend" install -Dm644 "contrib/completions/_ffsend" \ "$pkgdir/usr/share/zsh/site-functions/_ffsend" install -Dm644 "contrib/completions/ffsend.fish" \ "$pkgdir/usr/share/fish/vendor_completions.d/ffsend.fish" install -Dm644 "LICENSE" \ "$pkgdir/usr/share/licenses/ffsend/LICENSE" } ================================================ FILE: pkg/choco/ffsend/ffsend.nuspec ================================================  ffsend 0.0.0 https://github.com/timvisee/ffsend/tree/master/pkg/choco/ffsend Tim Visee ffsend (Install) Tim Visee https://github.com/timvisee/ffsend http://cdn.rawgit.com/timvisee/ffsend/master/res/ffsend.png 2017-2019 Tim Visee https://raw.githubusercontent.com/timvisee/ffsend/master/LICENSE false https://github.com/timvisee/ffsend https://github.com/timvisee/ffsend https://gitlab.com/timvisee/ffsend/issues ffsend firefox-send cli file-sharing file-upload encryption rust Easily and securely share files from the command line. A fully featured Send client. Easily and securely share files from the command line. A fully featured Send client. ================================================ FILE: pkg/choco/ffsend/tools/LICENSE.txt ================================================ From: https://www.gnu.org/licenses/gpl-3.0.en.html LICENSE GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2018 Tim Visee. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ================================================ FILE: pkg/choco/ffsend/tools/VERIFICATION.txt ================================================ VERIFICATION Verification is intended to assist the Chocolatey moderators and community in verifying that this package's contents are trustworthy. Binaries can be compared to versions available at: https://github.com/timvisee/ffsend/releases ================================================ FILE: pkg/create_deb ================================================ #!/usr/bin/env bash set -e # Ensure the version tag is valid if [[ ! $TRAVIS_TAG =~ ^v([0-9]+\.)*[0-9]+$ ]]; then echo "Error: invalid Git tag in \$TRAVIS_TAG, must be in 'v0.0.0' format" exit 1 fi # Ensure the debian architecture is set if [[ -z $DEB_ARCH ]]; then echo "Error: debian architecture not configured in \$DEB_ARCH" exit 1 fi # Define some useful variables DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) VERSION=${TRAVIS_TAG:1} # Ensure the binary file exists if [[ ! -f "$DIR/../ffsend" ]]; then echo "Error: missing 'ffsend' binary in repository root" exit 1 fi # Create an application directory, copy the binary into it mkdir -p "$DIR/ffsend-$VERSION" cp -- "$DIR/../ffsend" "$DIR/ffsend-$VERSION/ffsend" # Create an application tarball cd -- "$DIR/.." git archive --format tar.gz -o "$DIR/ffsend-$VERSION/ffsend-$VERSION.tar.gz" "$TRAVIS_TAG" # Change into the app directory cd -- "$DIR/ffsend-$VERSION" # Build the debian package # TODO: define GPG? dh_make -e "timvisee@gmail.com" -c gpl3 -f "ffsend-$VERSION.tar.gz" -s -y rm -- *.ex README.Debian README.source # Remove the project tar ball, we're not using it anymore rm -- "$DIR/ffsend-$VERSION/ffsend-$VERSION.tar.gz" # TODO: configure the debian/control file # TODO: configure copyright file # # Update version and architecture in the control file # sed -i "/Version:\.*/c\\Version: $VERSION" $DIR/deb/DEBIAN/control # sed -i "/Architecture:\.*/c\\Architecture: $DEB_ARCH" $DIR/deb/DEBIAN/control # # Build the debian package # echo "Building debian package..." # dpkg-deb --verbose --build $DIR/deb . ================================================ FILE: pkg/deb/postinst ================================================ #!/usr/bin/env bash # Create an ffs alias if [[ ! -f /usr/bin/ffs ]]; then echo "Creating ffs alias for ffsend..." ln -s /usr/bin/ffsend /usr/bin/ffs fi ================================================ FILE: pkg/deb/prerm ================================================ #!/usr/bin/env bash # Unlink the ffs alias if it links to ffsend if [[ -L /usr/bin/ffs ]] \ && [[ $(realpath /usr/bin/ffs) == "/usr/bin/ffsend" ]]; \ then echo "Removing ffs alias for ffsend..." unlink /usr/bin/ffs fi ================================================ FILE: pkg/docker/Dockerfile ================================================ FROM alpine:latest LABEL maintainer="Tim Visée <3a4fb3964f@sinenomine.email>" COPY ./ffsend / WORKDIR /data/ ENTRYPOINT ["/ffsend"] ================================================ FILE: pkg/scoop/README.md ================================================ # scoop manifest for ffsend This directory contains a [`scoop`][scoop] manifest template for `ffsend`. The currently published manifest can be found in the `scoop` repository, and is automatically updated: https://github.com/ScoopInstaller/Main/blob/master/bucket/ffsend.json [scoop]: https://scoop.rs/ ================================================ FILE: pkg/scoop/ffsend.json ================================================ { "homepage": "https://github.com/timvisee/ffsend", "description": "Easily and securely share files from the command line. A fully featured Send client.", "license": "GPL-3.0-only", "version": "0.0.0", "architecture": { "64bit": { "url": "https://github.com/timvisee/ffsend/releases/download/v0.2.30/ffsend-v0.2.30-windows-x64-static.exe#/ffsend.exe", "hash": "297f1405bacdc34948cd94ba785336c48e1ac862984268d66a8928abd3e322e1" } }, "bin": "ffsend.exe", "checkver": "github", "autoupdate": { "architecture": { "64bit": { "url": "https://github.com/timvisee/ffsend/releases/download/v$version/ffsend-v$version-windows-x64-static.exe#/ffsend.exe" } } } } ================================================ FILE: res/asciinema-demo.json ================================================ { "version": 1, "width": 102, "height": 19, "duration": 78.431135, "command": null, "title": "ffsend v0.0.9 demo", "env": { "TERM": "xterm-256color", "SHELL": "/bin/bash" }, "stdout": [ [ 0.000446, "\u001b[01;34m~/ffsend\u001b[00m $ " ], [ 1, "f" ], [ 0.311074, "f" ], [ 0.107298, "s" ], [ 0.112108, "e" ], [ 0.052915, "n" ], [ 0.103452, "d" ], [ 0.076084, "\r\n" ], [ 0.004048, "ffsend 0.0.7\r\nUsage: ffsend [FLAGS] ...\r\n\r\nSecurely and easily share files from the command line.\r\nA fully featured Firefox Send client.\r\n\r\nMissing subcommand. Here are the most used:\r\n" ], [ 0.000148, " \u001b[33mffsend upload ...\u001b[0m\r\n \u001b[33mffsend download ...\u001b[0m\r\n\r\nTo show all subcommands, features and other help:\r\n \u001b[33mffsend help [SUBCOMMAND]\u001b[0m\r\n" ], [ 0.000414, "\u001b[01;34m~/ffsend\u001b[00m $ " ], [ 3.727418, "\r\n" ], [ 0.000203, "\u001b[01;34m~/ffsend\u001b[00m $ " ], [ 0.097661, "f" ], [ 0.122247, "f" ], [ 0.05605, "s" ], [ 0.087885, "e" ], [ 0.060899, "n" ], [ 0.096174, "d" ], [ 0.061232, " " ], [ 0.060431, "u" ], [ 0.03782, "p" ], [ 0.13847, "l" ], [ 0.11866, "o" ], [ 0.033067, "a" ], [ 0.027852, "d" ], [ 0.069364, " " ], [ 0.084982, "i" ], [ 0.051328, "m" ], [ 0.010214, "a" ], [ 0.054744, "g" ], [ 0.059566, "e" ], [ 0.036545, "." ], [ 0.136904, "p" ], [ 0.144499, "n" ], [ 0.075098, "g" ], [ 0.063966, " " ], [ 0.197218, "-" ], [ 0.098887, "-" ], [ 0.183252, "c" ], [ 0.076421, "o" ], [ 0.055157, "p" ], [ 0.083875, "y" ], [ 1.318772, "\r\n" ], [ 0.006129, "\rEncrypt & Upload 7.88 KB / 116.93 KB [==>-------------------------------------] 6.74 % 164.29 MB/s 0s " ], [ 0.004434, "\rEncrypt & Upload 116.93 KB / 116.93 KB [=======================================] 100.00 % 26.44 MB/s \rUpload complete\r\n" ], [ 0.000379, "Share link:\u001b(B\u001b[m http://send.firefox.com/download/eb2ab818cc/#F8_WgM3tz1t05yiPMsBgIw\u001b(B\u001b[m \r\n" ], [ 0.010614, "\u001b[01;34m~/ffsend\u001b[00m $ " ], [ 2.025804, "\r\n" ], [ 0.000202, "\u001b[01;34m~/ffsend\u001b[00m $ " ], [ 0.243031, "f" ], [ 0.139251, "f" ], [ 0.023956, "s" ], [ 0.147834, "e" ], [ 0.08333, "n" ], [ 0.10299, "d" ], [ 0.060944, " " ], [ 0.101654, "d" ], [ 0.070479, "o" ], [ 0.072873, "w" ], [ 0.074426, "n" ], [ 0.052316, "l" ], [ 0.123539, "o" ], [ 0.050095, "a" ], [ 0.042724, "d" ], [ 0.059361, " " ], [ 0.394567, "http://send.firefox.com/download/eb2ab818cc/#F8_WgM3tz1t05yiPMsBgIw" ], [ 1.808662, "\r\n" ], [ 0.018087, "The path '/home/timvisee/ffsend/image.png' already exists\r\nOverwrite? [y/n]: " ], [ 2.255111, "y" ], [ 0.344455, "\r\n" ], [ 0.006962, "\rDownload & Decrypt 7.49 KB / 116.93 KB [==>------------------------------------] 6.41 % 45.45 MB/s 0s " ], [ 0.002159, "\rDownload & Decrypt 116.93 KB / 116.93 KB [=====================================] 100.00 % 46.05 MB/s \rDownload completed\r\n" ], [ 0.00258, "\u001b[01;34m~/ffsend\u001b[00m $ " ], [ 1.273051, "c" ], [ 0.085775, "l" ], [ 0.088002, "e" ], [ 0.063911, "a" ], [ 0.028405, "r" ], [ 0.117617, "\r\n" ], [ 0.002596, "\u001b[3J\u001b[H\u001b[2J" ], [ 0.000426, "\u001b[01;34m~/ffsend\u001b[00m $ " ], [ 0.451685, "t" ], [ 0.147318, "r" ], [ 0.035882, "e" ], [ 0.143284, "e" ], [ 0.099064, "\r\n" ], [ 0.001387, "\u001b[01;34m.\u001b[00m\r\n" ], [ 4.6e-05, "├── \u001b[01;34mdir\u001b[00m\r\n" ], [ 8.2e-05, "│   ├── \u001b[01;35mimage1.png\u001b[00m\r\n│   ├── \u001b[01;35mimage2.png\u001b[00m\r\n│   ├── \u001b[01;35mimage3.png\u001b[00m\r\n" ], [ 3.5e-05, "│   ├── \u001b[01;35mimage4.png\u001b[00m\r\n│   └── \u001b[01;35mimage5.png\u001b[00m\r\n└── \u001b[01;35mimage.png\u001b[00m\r\n\r\n1 directory, 6 files\r\n" ], [ 0.000269, "\u001b[01;34m~/ffsend\u001b[00m $ " ], [ 1.35093, "f" ], [ 0.138635, "f" ], [ 0.027636, "s" ], [ 0.108943, "e" ], [ 0.083283, "n" ], [ 0.081298, "d" ], [ 0.066286, " " ], [ 0.124465, "u" ], [ 0.123613, "p" ], [ 0.198503, "l" ], [ 0.197546, "o" ], [ 0.093234, "a" ], [ 0.039311, "d" ], [ 0.074587, " " ], [ 0.155511, "-" ], [ 0.107025, "-" ], [ 0.30897, "h" ], [ 0.038037, "o" ], [ 0.050418, "s" ], [ 0.065752, "t" ], [ 0.037937, " " ], [ 0.22728, "h" ], [ 0.162005, "t" ], [ 0.129107, "t" ], [ 0.057937, "p" ], [ 0.185544, ":" ], [ 0.149125, "/" ], [ 0.105709, "/" ], [ 0.179433, "l" ], [ 0.149999, "o" ], [ 0.054508, "c" ], [ 0.028218, "a" ], [ 0.083596, "l" ], [ 0.166794, "h" ], [ 0.061429, "o" ], [ 0.062438, "s" ], [ 0.048826, "t" ], [ 0.277334, "/" ], [ 0.097705, " " ], [ 0.898511, "." ], [ 0.243449, "/" ], [ 0.13176, "d" ], [ 0.087721, "i" ], [ 0.069036, "r" ], [ 0.056833, " " ], [ 0.423555, "-" ], [ 0.103734, "-" ], [ 0.075639, "c" ], [ 0.079152, "o" ], [ 0.075414, "p" ], [ 0.067769, "y" ], [ 0.048457, " " ], [ 0.139606, "-" ], [ 0.085638, "-" ], [ 0.159108, "p" ], [ 0.057905, "a" ], [ 0.127221, "s" ], [ 0.125608, "s" ], [ 0.151744, "w" ], [ 0.097711, "o" ], [ 0.061007, "r" ], [ 0.154988, "d" ], [ 0.078481, " " ], [ 0.114123, "-" ], [ 0.091159, "-" ], [ 0.070143, "d" ], [ 0.11245, "o" ], [ 0.041233, "w" ], [ 0.135844, "n" ], [ 0.082433, "l" ], [ 0.136912, "o" ], [ 0.045263, "a" ], [ 0.070978, "d" ], [ 0.157074, "s" ], [ 0.0916, " " ], [ 0.139081, "1" ], [ 0.082388, "0" ], [ 0.546882, "\r\n" ], [ 0.010193, "You've selected a directory, only a single file may be uploaded.\r\nArchive the directory into a single file? [Y/n]: " ], [ 3.589859, "y" ], [ 0.328803, "\r\nArchiving...\r\n" ], [ 0.001366, "Password: " ], [ 2.049001, "\r\n" ], [ 0.0006, "\rEncrypt & Upload 7.88 KB / 589.02 KB [>----------------------------------------] 1.34 % 73.23 MB/s 0s " ], [ 0.056393, "\rEncrypt & Upload 589.02 KB / 589.02 KB [=======================================] 100.00 % 10.18 MB/s " ], [ 0.000241, "\rUpload complete\r\n" ], [ 0.007118, "Share link:\u001b(B\u001b[m http://localhost/download/8c676a0415/#ppyvURZnNKxAXP503zx4ow\u001b(B\u001b[m \r\n" ], [ 0.013095, "\u001b[01;34m~/ffsend\u001b[00m $ " ], [ 2.812126, "r" ], [ 0.106401, "m" ], [ 0.065776, " " ], [ 0.109802, "-" ], [ 0.107358, "r" ], [ 0.052046, " " ], [ 0.197937, "d" ], [ 0.110728, "i" ], [ 0.088048, "r" ], [ 0.478528, "\r\n" ], [ 0.001914, "\u001b[01;34m~/ffsend\u001b[00m $ " ], [ 1.696512, "t" ], [ 0.165512, "r" ], [ 0.053922, "e" ], [ 0.136209, "e" ], [ 0.617314, "\r\n" ], [ 0.002698, "\u001b[01;34m.\u001b[00m\r\n└── \u001b[01;35mimage.png\u001b[00m\r\n\r\n0 directories, 1 file\r\n" ], [ 0.000599, "\u001b[01;34m~/ffsend\u001b[00m $ " ], [ 2.565528, "\r\n" ], [ 0.000117, "\u001b[01;34m~/ffsend\u001b[00m $ " ], [ 0.101676, "f" ], [ 0.134166, "f" ], [ 0.052074, "s" ], [ 0.113215, "e" ], [ 0.094931, "n" ], [ 0.071806, "d" ], [ 0.067825, " " ], [ 0.074399, "d" ], [ 0.073672, "o" ], [ 0.062621, "w" ], [ 0.086107, "n" ], [ 0.056469, "l" ], [ 0.132919, "o" ], [ 0.070761, "a" ], [ 0.035916, "d" ], [ 0.051305, " " ], [ 0.451896, "http://localhost/download/8c676a0415/#ppyvURZnNKxAXP503zx4ow" ], [ 1.161843, "\r\n" ], [ 0.011099, "This file is protected with a password.\r\nPassword: " ], [ 2.810903, "\r\n" ], [ 0.008816, "You're downloading an archive, extract it into the selected directory? [Y/n]: " ], [ 2.888769, "y" ], [ 0.275081, "\r\n" ], [ 0.004008, "\rDownload & Decrypt 7.49 KB / 589.02 KB [>--------------------------------------] 1.27 % 33.97 MB/s 0s " ], [ 0.005111, "\rDownload & Decrypt 589.02 KB / 589.02 KB [====================================] 100.00 % 105.05 MB/s \rDownload complete \r\n" ], [ 0.001558, "Extracting..." ], [ 0.000667, "\r\n" ], [ 0.006159, "\u001b[01;34m~/ffsend\u001b[00m $ " ], [ 2.29007, "t" ], [ 0.170948, "r" ], [ 0.055106, "e" ], [ 0.141162, "e" ], [ 0.313824, "\r\n" ], [ 0.002934, "\u001b[01;34m.\u001b[00m\r\n" ], [ 0.00015, "├── \u001b[01;34mdir\u001b[00m" ], [ 9.2e-05, "\r\n" ], [ 0.000103, "│   ├── \u001b[01;35mimage1.png\u001b[00m" ], [ 6.5e-05, "\r\n" ], [ 8.7e-05, "│   ├── \u001b[01;35mimage2.png\u001b[00m" ], [ 6e-05, "\r\n" ], [ 8.7e-05, "│   ├── \u001b[01;35mimage3.png\u001b[00m" ], [ 8.8e-05, "\r\n" ], [ 0.000172, "│   ├── \u001b[01;35mimage4.png\u001b[00m\r\n│   └── \u001b[01;35mimage5.png\u001b[00m\r\n" ], [ 6e-05, "└── \u001b[01;35mimage.png\u001b[00m\r\n\r\n1 directory, 6 files\r\n" ], [ 0.000758, "\u001b[01;34m~/ffsend\u001b[00m $ " ], [ 3.895998, "c" ], [ 0.286706, "l" ], [ 0.127313, "e" ], [ 0.068267, "a" ], [ 0.019578, "r" ], [ 0.236386, "\r\n" ], [ 0.001683, "\u001b[3J\u001b[H\u001b[2J" ], [ 0.000337, "\u001b[01;34m~/ffsend\u001b[00m $ " ], [ 0.328594, "f" ], [ 0.123586, "f" ], [ 0.055619, "s" ], [ 0.094709, "e" ], [ 0.069749, "n" ], [ 0.093652, "d" ], [ 0.060866, " " ], [ 0.036796, "i" ], [ 0.04626, "n" ], [ 0.061367, " " ], [ 0.098436, "f" ], [ 0.218131, "\b\u001b[K" ], [ 0.094286, "\b\u001b[K" ], [ 0.091956, "f" ], [ 0.093555, "o" ], [ 0.060616, " " ], [ 0.424389, "http://localhost/download/8c676a0415/#ppyvURZnNKxAXP503zx4ow" ], [ 0.537385, "\r\n" ], [ 0.009675, "This file is protected with a password.\r\nPassword: " ], [ 3.343676, "\r\n" ], [ 0.014916, "ID: \u001b(B\u001b[m 8c676a0415\u001b(B\u001b[m \r\nName: \u001b(B\u001b[m dir.tar\u001b(B\u001b[m \r\nSize: \u001b(B\u001b[m 589.02 KiB (603152 B)\u001b(B\u001b[m \r\nMIME: \u001b(B\u001b[m application/x-tar\u001b(B\u001b[m \r\nDownloads:\u001b(B\u001b[m 1 of 10\u001b(B\u001b[m \r\nExpiry: \u001b(B\u001b[m 23h59m (86369s)\u001b(B\u001b[m \r\n" ], [ 0.001792, "\u001b[01;34m~/ffsend\u001b[00m $ " ], [ 4.928383, "\r\n" ], [ 0.000199, "\u001b[01;34m~/ffsend\u001b[00m $ " ], [ 0.117653, "f" ], [ 0.129906, "f" ], [ 0.032962, "s" ], [ 0.113666, "e" ], [ 0.089314, "n" ], [ 0.065384, "d" ], [ 0.065542, " " ], [ 0.065172, "h" ], [ 0.046016, "i" ], [ 0.033428, "s" ], [ 0.062997, "t" ], [ 0.057587, "o" ], [ 0.09366, "r" ], [ 0.155138, "y" ], [ 0.436485, "\r\n" ], [ 0.003618, "#\u001b(B\u001b[m LINK \u001b(B\u001b[m EXPIRY\u001b(B\u001b[m OWNER TOKEN\u001b(B\u001b[m \r\n1\u001b(B\u001b[m http://localhost/download/8c676a0415/#ppyvURZnNKxAXP503zx4ow \u001b(B\u001b[m 23h59m\u001b(B\u001b[m 4cfe63017d9eade8a955\u001b(B\u001b[m \r\n2\u001b(B\u001b[m http://send.firefox.com/download/eb2ab818cc/#F8_WgM3tz1t05yiPMsBgIw\u001b(B\u001b[m 23h58m\u001b(B\u001b[m 084577d86526aa999dc6\u001b(B\u001b[m \r\n" ], [ 0.000651, "\u001b[01;34m~/ffsend\u001b[00m $ " ] ] } ================================================ FILE: res/asciinema-to-svg ================================================ #!/usr/bin/env bash # Ensure svg-term is installed if ! [ -x "$(command -v svg-term)" ]; then echo "svg-term is not installed, unable to create SVG, use:" echo "sudo npm install -g svg-term-cli" exit 1 fi # Convert into a GIF echo "Generating SVG..." cat asciinema-demo.json | svg-term --out demo.svg --window echo "Done" ================================================ FILE: src/action/debug.rs ================================================ use chrono::Duration; use clap::ArgMatches; use ffsend_api::config::SEND_DEFAULT_EXPIRE_TIME; use prettytable::{format::FormatBuilder, Cell, Row, Table}; use crate::client::to_duration; use crate::cmd::matcher::{debug::DebugMatcher, main::MainMatcher, Matcher}; use crate::error::ActionError; #[cfg(feature = "clipboard-bin")] use crate::util::ClipboardType; use crate::util::{api_version_list, features_list, format_bool, format_duration}; /// A file debug action. pub struct Debug<'a> { cmd_matches: &'a ArgMatches<'a>, } impl<'a> Debug<'a> { /// Construct a new debug action. pub fn new(cmd_matches: &'a ArgMatches<'a>) -> Self { Self { cmd_matches } } /// Invoke the debug action. // TODO: create a trait for this method pub fn invoke(&self) -> Result<(), ActionError> { // Create the command matchers let matcher_main = MainMatcher::with(self.cmd_matches).unwrap(); let matcher_debug = DebugMatcher::with(self.cmd_matches).unwrap(); // Create a table for all debug information let mut table = Table::new(); table.set_format(FormatBuilder::new().padding(0, 2).build()); // The crate version table.add_row(Row::new(vec![ Cell::new("Version:"), Cell::new(crate_version!()), ])); // The default host table.add_row(Row::new(vec![ Cell::new("Host:"), Cell::new(matcher_debug.host().as_str()), ])); // The history file #[cfg(feature = "history")] table.add_row(Row::new(vec![ Cell::new("History file:"), Cell::new(matcher_main.history().to_str().unwrap_or("?")), ])); // The timeouts table.add_row(Row::new(vec![ Cell::new("Timeout:"), Cell::new( &to_duration(matcher_main.timeout()) .map(|t| { format_duration( Duration::from_std(t).expect("failed to convert timeout duration"), ) }) .unwrap_or("disabled".into()), ), ])); table.add_row(Row::new(vec![ Cell::new("Transfer timeout:"), Cell::new( &to_duration(matcher_main.transfer_timeout()) .map(|t| { format_duration( Duration::from_std(t) .expect("failed to convert transfer timeout duration"), ) }) .unwrap_or("disabled".into()), ), ])); // The default host table.add_row(Row::new(vec![ Cell::new("Default expiry:"), Cell::new(&format_duration(Duration::seconds( SEND_DEFAULT_EXPIRE_TIME as i64, ))), ])); // Render a list of compiled features table.add_row(Row::new(vec![ Cell::new("Features:"), Cell::new(&features_list().join(", ")), ])); // Render a list of compiled features table.add_row(Row::new(vec![ Cell::new("API support:"), Cell::new(&api_version_list().join(", ")), ])); // Show used crypto backend table.add_row(Row::new(vec![ Cell::new("Crypto backend:"), #[cfg(feature = "crypto-ring")] Cell::new("ring"), #[cfg(feature = "crypto-openssl")] Cell::new("OpenSSL"), ])); // Clipboard information #[cfg(feature = "clipboard-bin")] table.add_row(Row::new(vec![ Cell::new("Clipboard:"), Cell::new(&format!("{}", ClipboardType::select())), ])); // Show whether quiet is used table.add_row(Row::new(vec![ Cell::new("Quiet:"), Cell::new(format_bool(matcher_main.quiet())), ])); // Show whether verbose is used table.add_row(Row::new(vec![ Cell::new("Verbose:"), Cell::new(format_bool(matcher_main.verbose())), ])); // Print the debug table table.printstd(); Ok(()) } } ================================================ FILE: src/action/delete.rs ================================================ use clap::ArgMatches; use ffsend_api::action::delete::{Delete as ApiDelete, Error as DeleteError}; use ffsend_api::file::remote_file::{FileParseError, RemoteFile}; use crate::client::create_config; use crate::cmd::matcher::{delete::DeleteMatcher, main::MainMatcher, Matcher}; use crate::error::ActionError; #[cfg(feature = "history")] use crate::history_tool; use crate::util::{ensure_owner_token, print_success}; /// A file delete action. pub struct Delete<'a> { cmd_matches: &'a ArgMatches<'a>, } impl<'a> Delete<'a> { /// Construct a new delete action. pub fn new(cmd_matches: &'a ArgMatches<'a>) -> Self { Self { cmd_matches } } /// Invoke the delete action. // TODO: create a trait for this method pub fn invoke(&self) -> Result<(), ActionError> { // Create the command matchers let matcher_main = MainMatcher::with(self.cmd_matches).unwrap(); let matcher_delete = DeleteMatcher::with(self.cmd_matches).unwrap(); // Get the share link let url = matcher_delete.url(); // Create client let client_config = create_config(&matcher_main); let client = client_config.client(false); // Parse the remote file based on the share link, derive the owner token from history let mut file = RemoteFile::parse_url(url, matcher_delete.owner())?; #[cfg(feature = "history")] history_tool::derive_file_properties(&matcher_main, &mut file); // Ensure the owner token is set ensure_owner_token(file.owner_token_mut(), &matcher_main, false); // Send the file deletion request let result = ApiDelete::new(&file, None).invoke(&client); if let Err(DeleteError::Expired) = result { // Remove the file from the history manager if it does not exist #[cfg(feature = "history")] history_tool::remove(&matcher_main, &file); } result?; // Remove the file from the history manager #[cfg(feature = "history")] history_tool::remove(&matcher_main, &file); // Print a success message print_success("File deleted"); Ok(()) } } #[derive(Debug, Fail)] pub enum Error { /// Failed to parse a share URL, it was invalid. /// This error is not related to a specific action. #[fail(display = "invalid share link")] InvalidUrl(#[cause] FileParseError), /// Could not delete, the file has expired or did never exist. #[fail(display = "the file has expired or did never exist")] Expired, /// An error occurred while deleting the remote file. #[fail(display = "failed to delete the shared file")] Delete(#[cause] DeleteError), } impl From for Error { fn from(err: FileParseError) -> Error { Error::InvalidUrl(err) } } impl From for Error { fn from(err: DeleteError) -> Error { match err { DeleteError::Expired => Error::Expired, err => Error::Delete(err), } } } ================================================ FILE: src/action/download.rs ================================================ use std::env::current_dir; use std::fs::create_dir_all; #[cfg(feature = "archive")] use std::io::Error as IoError; use std::path::{self, PathBuf}; use std::sync::{Arc, Mutex}; use clap::ArgMatches; use failure::Fail; use ffsend_api::action::download::{Download as ApiDownload, Error as DownloadError}; use ffsend_api::action::exists::{Error as ExistsError, Exists as ApiExists}; use ffsend_api::action::metadata::{Error as MetadataError, Metadata as ApiMetadata}; use ffsend_api::action::version::Error as VersionError; use ffsend_api::file::remote_file::{FileParseError, RemoteFile}; use ffsend_api::pipe::ProgressReporter; #[cfg(feature = "archive")] use tempfile::{Builder as TempBuilder, NamedTempFile}; use super::select_api_version; #[cfg(feature = "archive")] use crate::archive::archive::Archive; use crate::client::create_config; use crate::cmd::matcher::{download::DownloadMatcher, main::MainMatcher, Matcher}; #[cfg(feature = "history")] use crate::history_tool; use crate::progress::ProgressBar; use crate::util::{ ensure_enough_space, ensure_password, follow_url, print_error, prompt_yes, quit, quit_error, quit_error_msg, ErrorHints, }; /// A file download action. pub struct Download<'a> { cmd_matches: &'a ArgMatches<'a>, } impl<'a> Download<'a> { /// Construct a new download action. pub fn new(cmd_matches: &'a ArgMatches<'a>) -> Self { Self { cmd_matches } } /// Invoke the download action. // TODO: create a trait for this method pub fn invoke(&self) -> Result<(), Error> { // Create the command matchers let matcher_main = MainMatcher::with(self.cmd_matches).unwrap(); let matcher_download = DownloadMatcher::with(self.cmd_matches).unwrap(); // Create a regular client let client_config = create_config(&matcher_main); let client = client_config.clone().client(false); // Get the share URL, attempt to follow it let url = matcher_download.url(); let url = match follow_url(&client, &url) { Ok(url) => url, Err(err) => { print_error(err.context("failed to follow share URL, ignoring").compat()); url } }; // Guess the host let host = matcher_download.guess_host(Some(url.clone())); // Determine the API version to use let mut desired_version = matcher_main.api(); select_api_version(&client, host, &mut desired_version)?; let api_version = desired_version.version().unwrap(); // Parse the remote file based on the share URL let file = RemoteFile::parse_url(url, None)?; // Get the target file or directory, and the password let target = matcher_download.output(); let mut password = matcher_download.password(); // Check whether the file exists let exists = ApiExists::new(&file).invoke(&client)?; if !exists.exists() { // Remove the file from the history manager if it does not exist #[cfg(feature = "history")] history_tool::remove(&matcher_main, &file); return Err(Error::Expired); } // Ensure a password is set when required ensure_password( &mut password, exists.requires_password(), &matcher_main, false, ); // Fetch the file metadata let metadata = ApiMetadata::new(&file, password.clone(), false).invoke(&client)?; // A temporary archive file, only used when archiving // The temporary file is stored here, to ensure it's lifetime exceeds the upload process #[cfg(feature = "archive")] let mut tmp_archive: Option = None; // Check whether to extract #[cfg(feature = "archive")] let mut extract = matcher_download.extract(); #[cfg(feature = "archive")] { // Ask to extract if downloading an archive if !extract && metadata.metadata().is_archive() { if prompt_yes( "You're downloading an archive, extract it into the selected directory?", Some(true), &matcher_main, ) { extract = true; } } } // Prepare the download target and output path to use #[cfg(feature = "archive")] let output_dir = !extract; #[cfg(not(feature = "archive"))] let output_dir = false; #[allow(unused_mut)] let mut target = Self::prepare_path( &target, metadata.metadata().name(), &matcher_main, output_dir, ); #[cfg(feature = "archive")] let output_path = target.clone(); #[cfg(feature = "archive")] { // Allocate an archive file, and update the download and target paths if extract { // TODO: select the extension dynamically let archive_extention = ".tar"; // Allocate a temporary file to download the archive to tmp_archive = Some( TempBuilder::new() .prefix(&format!(".{}-archive-", crate_name!())) .suffix(archive_extention) .tempfile() .map_err(ExtractError::TempFile)?, ); if let Some(tmp_archive) = &tmp_archive { target = tmp_archive.path().to_path_buf(); } } } // Ensure there is enough disk space available when not being forced if !matcher_main.force() { ensure_enough_space(target.parent().unwrap(), metadata.size()); } // Create a progress bar reporter let progress_bar = Arc::new(Mutex::new(ProgressBar::new_download())); let progress_reader: Arc> = progress_bar; // Create a transfer client let transfer_client = client_config.client(true); // Execute an download action let progress = if !matcher_main.quiet() { Some(progress_reader) } else { None }; ApiDownload::new(api_version, &file, target, password, false, Some(metadata)) .invoke(&transfer_client, progress)?; // Extract the downloaded file if working with an archive #[cfg(feature = "archive")] { if extract { eprintln!("Extracting..."); // Extract the downloaded file Archive::new(tmp_archive.unwrap().into_file()) .extract(output_path) .map_err(ExtractError::Extract)?; } } // Add the file to the history #[cfg(feature = "history")] history_tool::add(&matcher_main, file, true); // TODO: open the file, or it's location // TODO: copy the file location Ok(()) } /// This methods prepares a full file path to use for the file to /// download, based on the current directory, the original file name, /// and the user input. /// If `file` is set to false, no file name is included and the path /// will point to a directory. /// /// If no file name was given, the original file name is used. /// /// The full path including the name is returned. /// /// This method will check whether a file is overwritten, and whether /// parent directories must be created. /// /// The program will quit with an error message if a problem occurs. fn prepare_path( target: &PathBuf, name_hint: &str, main_matcher: &MainMatcher, file: bool, ) -> PathBuf { // Select the path to use let mut target = Self::select_path(&target, name_hint); // Use the parent directory, if we don't want a file if !file { target = target.parent().unwrap().to_path_buf(); } // Ask to overwrite if file && target.exists() && !main_matcher.force() { eprintln!( "The path '{}' already exists", target.to_str().unwrap_or("?"), ); if !prompt_yes("Overwrite?", None, main_matcher) { println!("Download cancelled"); quit(); } } { // Get the deepest directory, as we have to ensure it exists let dir = if file { match target.parent() { Some(parent) => parent, None => quit_error_msg("invalid output file path", ErrorHints::default()), } } else { &target }; // Ensure the directory exists if !dir.is_dir() { // Prompt to create them if not forced if !main_matcher.force() { eprintln!( "The directory '{}' doesn't exists", dir.to_str().unwrap_or("?"), ); if !prompt_yes("Create it?", Some(true), main_matcher) { println!("Download cancelled"); quit(); } } // Create the parent directories if let Err(err) = create_dir_all(dir) { quit_error( err.context("failed to create parent directories for output file"), ErrorHints::default(), ); } } } target } /// This methods prepares a full file path to use for the file to /// download, based on the current directory, the original file name, /// and the user input. /// /// If no file name was given, the original file name is used. /// /// The full path including the file name will be returned. fn select_path(target: &PathBuf, name_hint: &str) -> PathBuf { // If we're already working with a file, canonicalize and return if target.is_file() { match target.canonicalize() { Ok(target) => return target, Err(err) => quit_error( err.context("failed to canonicalize target path"), ErrorHints::default(), ), } } // Append the name hint if this is a directory, canonicalize and return if target.is_dir() { match target.canonicalize() { Ok(target) => return target.join(name_hint), Err(err) => quit_error( err.context("failed to canonicalize target path"), ErrorHints::default(), ), } } // TODO: canonicalize parent if it exists // Get the path string let path = target.to_str(); // If the path is empty, use the working directory with the name hint let use_workdir = path.map(|path| path.trim().is_empty()).unwrap_or(true); if use_workdir { match current_dir() { Ok(target) => return target.join(name_hint), Err(err) => quit_error( err.context("failed to determine working directory to use for the output file"), ErrorHints::default(), ), } } let path = path.unwrap(); // Make the target mutable let mut target = target.clone(); // If the path ends with a separator, append the name hint if path.trim().ends_with(path::is_separator) { target = target.join(name_hint); } // If relative, use the working directory as base if target.is_relative() { match current_dir() { Ok(workdir) => target = workdir.join(target), Err(err) => quit_error( err.context("failed to determine working directory to use for the output file"), ErrorHints::default(), ), } } target } } #[derive(Debug, Fail)] pub enum Error { /// Selecting the API version to use failed. // TODO: enable `api` hint! #[fail(display = "failed to select API version to use")] Version(#[cause] VersionError), /// Failed to parse a share URL, it was invalid. /// This error is not related to a specific action. #[fail(display = "invalid share link")] InvalidUrl(#[cause] FileParseError), /// An error occurred while checking if the file exists. #[fail(display = "failed to check whether the file exists")] Exists(#[cause] ExistsError), /// An error occurred while fetching metadata. #[fail(display = "failed to fetch file metadata")] Metadata(#[cause] MetadataError), /// An error occurred while downloading the file. #[fail(display = "")] Download(#[cause] DownloadError), /// An error occurred while extracting the file. #[cfg(feature = "archive")] #[fail(display = "failed the extraction procedure")] Extract(#[cause] ExtractError), /// The given Send file has expired, or did never exist in the first place. #[fail(display = "the file has expired or did never exist")] Expired, } impl From for Error { fn from(err: VersionError) -> Error { Error::Version(err) } } impl From for Error { fn from(err: FileParseError) -> Error { Error::InvalidUrl(err) } } impl From for Error { fn from(err: ExistsError) -> Error { Error::Exists(err) } } impl From for Error { fn from(err: MetadataError) -> Error { Error::Metadata(err) } } impl From for Error { fn from(err: DownloadError) -> Error { Error::Download(err) } } #[cfg(feature = "archive")] impl From for Error { fn from(err: ExtractError) -> Error { Error::Extract(err) } } #[cfg(feature = "archive")] #[derive(Debug, Fail)] pub enum ExtractError { /// An error occurred while creating the temporary archive file. #[fail(display = "failed to create temporary archive file")] TempFile(#[cause] IoError), /// Failed to extract the file contents to the target directory. #[fail(display = "failed to extract archive contents to target directory")] Extract(#[cause] IoError), } ================================================ FILE: src/action/exists.rs ================================================ use clap::ArgMatches; use ffsend_api::action::exists::{Error as ExistsError, Exists as ApiExists}; use ffsend_api::file::remote_file::{FileParseError, RemoteFile}; use crate::client::create_config; use crate::cmd::matcher::main::MainMatcher; use crate::cmd::matcher::{exists::ExistsMatcher, Matcher}; use crate::error::ActionError; #[cfg(feature = "history")] use crate::history_tool; /// A file exists action. pub struct Exists<'a> { cmd_matches: &'a ArgMatches<'a>, } impl<'a> Exists<'a> { /// Construct a new exists action. pub fn new(cmd_matches: &'a ArgMatches<'a>) -> Self { Self { cmd_matches } } /// Invoke the exists action. // TODO: create a trait for this method pub fn invoke(&self) -> Result<(), ActionError> { // Create the command matchers let matcher_exists = ExistsMatcher::with(self.cmd_matches).unwrap(); let matcher_main = MainMatcher::with(self.cmd_matches).unwrap(); // Get the share URL let url = matcher_exists.url(); // Create a reqwest client let client_config = create_config(&matcher_main); let client = client_config.client(false); // Parse the remote file based on the share URL let file = RemoteFile::parse_url(url, None)?; // Make sure the file exists let exists_response = ApiExists::new(&file).invoke(&client)?; let exists = exists_response.exists(); // Print the results println!("Exists: {:?}", exists); if exists { println!("Password: {:?}", exists_response.requires_password()); } // Add or remove the file from the history #[cfg(feature = "history")] { if exists { history_tool::add(&matcher_main, file, false); } else { history_tool::remove(&matcher_main, &file); } } Ok(()) } } #[derive(Debug, Fail)] pub enum Error { /// Failed to parse a share URL, it was invalid. /// This error is not related to a specific action. #[fail(display = "invalid share link")] InvalidUrl(#[cause] FileParseError), /// An error occurred while checking if the file exists. #[fail(display = "failed to check whether the file exists")] Exists(#[cause] ExistsError), } impl From for Error { fn from(err: FileParseError) -> Error { Error::InvalidUrl(err) } } impl From for Error { fn from(err: ExistsError) -> Error { Error::Exists(err) } } ================================================ FILE: src/action/generate/completions.rs ================================================ use std::fs; use std::io; use clap::ArgMatches; use crate::cmd::matcher::{generate::completions::CompletionsMatcher, main::MainMatcher, Matcher}; use crate::error::ActionError; /// A file completions action. pub struct Completions<'a> { cmd_matches: &'a ArgMatches<'a>, } impl<'a> Completions<'a> { /// Construct a new completions action. pub fn new(cmd_matches: &'a ArgMatches<'a>) -> Self { Self { cmd_matches } } /// Invoke the completions action. // TODO: create a trait for this method pub fn invoke(&self) -> Result<(), ActionError> { // Create the command matchers let matcher_main = MainMatcher::with(self.cmd_matches).unwrap(); let matcher_completions = CompletionsMatcher::with(self.cmd_matches).unwrap(); // Obtain shells to generate completions for, build application definition let shells = matcher_completions.shells(); let dir = matcher_completions.output(); let quiet = matcher_main.quiet(); let mut app = crate::cmd::handler::Handler::build(); // If the directory does not exist yet, attempt to create it if !dir.is_dir() { fs::create_dir_all(&dir).map_err(Error::CreateOutputDir)?; } // Generate completions for shell in shells { if !quiet { eprint!( "Generating completions for {}...", format!("{}", shell).to_lowercase() ); } app.gen_completions(crate_name!(), shell, &dir); if !quiet { eprintln!(" done."); } } Ok(()) } } #[derive(Debug, Fail)] pub enum Error { /// An error occurred while creating the output directory. #[fail(display = "failed to create output directory, it doesn't exist")] CreateOutputDir(#[cause] io::Error), } ================================================ FILE: src/action/generate/mod.rs ================================================ pub mod completions; use clap::ArgMatches; use crate::cmd::matcher::{generate::GenerateMatcher, Matcher}; use crate::error::ActionError; use completions::Completions; /// A file generate action. pub struct Generate<'a> { cmd_matches: &'a ArgMatches<'a>, } impl<'a> Generate<'a> { /// Construct a new generate action. pub fn new(cmd_matches: &'a ArgMatches<'a>) -> Self { Self { cmd_matches } } /// Invoke the generate action. // TODO: create a trait for this method pub fn invoke(&self) -> Result<(), ActionError> { // Create the command matcher let matcher_generate = GenerateMatcher::with(self.cmd_matches).unwrap(); // Match shell completions if matcher_generate.matcher_completions().is_some() { return Completions::new(self.cmd_matches).invoke(); } // Unreachable, clap will print help for missing sub command instead unreachable!() } } ================================================ FILE: src/action/history.rs ================================================ use clap::ArgMatches; use failure::Fail; use prettytable::{format::FormatBuilder, Cell, Row, Table}; use crate::cmd::matcher::{history::HistoryMatcher, main::MainMatcher, Matcher}; use crate::error::ActionError; use crate::history::{History as HistoryManager, LoadError as HistoryLoadError}; use crate::util::{format_duration, quit_error, quit_error_msg, ErrorHintsBuilder}; /// A history action. pub struct History<'a> { cmd_matches: &'a ArgMatches<'a>, } impl<'a> History<'a> { /// Construct a new history action. pub fn new(cmd_matches: &'a ArgMatches<'a>) -> Self { Self { cmd_matches } } /// Invoke the history action. // TODO: create a trait for this method pub fn invoke(&self) -> Result<(), ActionError> { // Create the command matchers let matcher_main = MainMatcher::with(self.cmd_matches).unwrap(); let matcher_history = HistoryMatcher::with(self.cmd_matches).unwrap(); // Get the history path, make sure it exists let history_path = matcher_main.history(); if !history_path.is_file() { if !matcher_main.quiet() { eprintln!("No files in history"); } return Ok(()); } // History let mut history = HistoryManager::load(history_path)?; // Do not report any files if there aren't any if history.files().is_empty() { if !matcher_main.quiet() { eprintln!("No files in history"); } return Ok(()); } // Clear all history if matcher_history.clear() { history.clear(); // Save history if let Err(err) = history.save() { quit_error( err, ErrorHintsBuilder::default().verbose(true).build().unwrap(), ); } eprintln!("History cleared"); return Ok(()); } // Remove history item if let Some(url) = matcher_history.rm() { // Remove item, print error if no item with URL was found match history.remove_url(url) { Ok(removed) if !removed => quit_error_msg( "could not remove item from history, no item matches given URL", ErrorHintsBuilder::default().verbose(true).build().unwrap(), ), Err(err) => quit_error( err.context("could not remove item from history"), ErrorHintsBuilder::default().verbose(true).build().unwrap(), ), _ => {} } // Save history if let Err(err) = history.save() { quit_error( err, ErrorHintsBuilder::default().verbose(true).build().unwrap(), ); } eprintln!("Item removed from history"); return Ok(()); } // Get the list of files, and sort the first expiring files to be last let mut files = history.files().clone(); files.sort_by(|a, b| b.expire_at().cmp(&a.expire_at())); // Log a history table, or just the URLs in quiet mode if !matcher_main.quiet() { // Build the list of column names let mut columns = vec!["#", "LINK", "EXPIRE"]; if matcher_main.verbose() { columns.push("OWNER TOKEN"); } // Create a new table let mut table = Table::new(); table.set_format(FormatBuilder::new().padding(0, 2).build()); table.add_row(Row::new(columns.into_iter().map(Cell::new).collect())); // Add an entry for each file for (i, file) in files.iter().enumerate() { // Build the expiry time string let mut expiry = format_duration(&file.expire_duration()); if file.expire_uncertain() { expiry.insert(0, '~'); } // Get the owner token let owner_token: String = match file.owner_token() { Some(token) => token.clone(), None => "?".into(), }; // Define the cell values let mut cells: Vec = vec![format!("{}", i + 1), file.download_url(true).into(), expiry]; if matcher_main.verbose() { cells.push(owner_token); } // Add the row table.add_row(Row::new(cells.into_iter().map(|c| Cell::new(&c)).collect())); } // Print the table table.printstd(); } else { files .iter() .for_each(|f| println!("{}", f.download_url(true))); } Ok(()) } } #[derive(Debug, Fail)] pub enum Error { /// Failed to load the history. #[fail(display = "Failed to load file history")] Load(#[cause] HistoryLoadError), } impl From for ActionError { fn from(err: HistoryLoadError) -> ActionError { ActionError::History(Error::Load(err)) } } ================================================ FILE: src/action/info.rs ================================================ use chrono::Duration; use clap::ArgMatches; use failure::Fail; use ffsend_api::action::exists::{Error as ExistsError, Exists as ApiExists}; use ffsend_api::action::info::{Error as InfoError, Info as ApiInfo}; use ffsend_api::action::metadata::Metadata as ApiMetadata; use ffsend_api::file::remote_file::{FileParseError, RemoteFile}; use prettytable::{format::FormatBuilder, Cell, Row, Table}; use crate::client::create_config; use crate::cmd::matcher::{info::InfoMatcher, main::MainMatcher, Matcher}; #[cfg(feature = "history")] use crate::history_tool; use crate::util::{ ensure_owner_token, ensure_password, format_bytes, format_duration, print_error, }; /// A file info action. pub struct Info<'a> { cmd_matches: &'a ArgMatches<'a>, } impl<'a> Info<'a> { /// Construct a new info action. pub fn new(cmd_matches: &'a ArgMatches<'a>) -> Self { Self { cmd_matches } } /// Invoke the info action. // TODO: create a trait for this method pub fn invoke(&self) -> Result<(), Error> { // Create the command matchers let matcher_main = MainMatcher::with(self.cmd_matches).unwrap(); let matcher_info = InfoMatcher::with(self.cmd_matches).unwrap(); // Get the share URL let url = matcher_info.url(); // Create a reqwest client let client_config = create_config(&matcher_main); let client = client_config.client(false); // Parse the remote file based on the share URL, derive the owner token from history let mut file = RemoteFile::parse_url(url, matcher_info.owner())?; #[cfg(feature = "history")] history_tool::derive_file_properties(&matcher_main, &mut file); // Ask the user to set the owner token for more detailed information let has_owner = ensure_owner_token(file.owner_token_mut(), &matcher_main, true); // Check whether the file exists let exists = ApiExists::new(&file).invoke(&client)?; if !exists.exists() { // Remove the file from the history manager if it doesn't exist #[cfg(feature = "history")] history_tool::remove(&matcher_main, &file); return Err(Error::Expired); } // Get the password, ensure the password is set when required let mut password = matcher_info.password(); let has_password = ensure_password( &mut password, exists.requires_password(), &matcher_main, true, ); // Fetch both file info and metadata let info = if has_owner { Some(ApiInfo::new(&file, None).invoke(&client)?) } else { None }; let metadata = if has_password { ApiMetadata::new(&file, password, false) .invoke(&client) .map_err(|err| { print_error(err.context("failed to fetch file metadata, showing limited info")) }) .ok() } else { None }; // Update history file TTL if info is known if let Some(info) = &info { let ttl_millis = info.ttl_millis() as i64; let ttl = Duration::milliseconds(ttl_millis); file.set_expire_duration(ttl); } // Add the file to the history #[cfg(feature = "history")] history_tool::add(&matcher_main, file.clone(), true); // Create a new table for the information let mut table = Table::new(); table.set_format(FormatBuilder::new().padding(0, 2).build()); // Add the ID table.add_row(Row::new(vec![Cell::new("ID:"), Cell::new(file.id())])); // Show file metadata if available if let Some(metadata) = &metadata { // The file name table.add_row(Row::new(vec![ Cell::new("Name:"), Cell::new(metadata.metadata().name()), ])); // The file size let size = metadata.size(); table.add_row(Row::new(vec![ Cell::new("Size:"), Cell::new(&if size >= 1024 { format!("{} ({} B)", format_bytes(size), size) } else { format_bytes(size) }), ])); // The file MIME table.add_row(Row::new(vec![ Cell::new("MIME:"), Cell::new(metadata.metadata().mime()), ])); } // Show file info if available if let Some(info) = &info { // The download count table.add_row(Row::new(vec![ Cell::new("Downloads:"), Cell::new(&format!( "{} of {}", info.download_count(), info.download_limit() )), ])); // The time to live let ttl_millis = info.ttl_millis() as i64; let ttl = Duration::milliseconds(ttl_millis); table.add_row(Row::new(vec![ Cell::new("Expiry:"), Cell::new(&if ttl_millis >= 60 * 1000 { format!("{} ({}s)", format_duration(&ttl), ttl.num_seconds()) } else { format_duration(&ttl) }), ])); } // Print the info table table.printstd(); Ok(()) } } #[derive(Debug, Fail)] pub enum Error { /// Failed to parse a share URL, it was invalid. /// This error is not related to a specific action. #[fail(display = "invalid share link")] InvalidUrl(#[cause] FileParseError), /// An error occurred while checking if the file exists. #[fail(display = "failed to check whether the file exists")] Exists(#[cause] ExistsError), /// An error occurred while fetching the file information. #[fail(display = "failed to fetch file info")] Info(#[cause] InfoError), /// The given Send file has expired, or did never exist in the first place. #[fail(display = "the file has expired or did never exist")] Expired, } impl From for Error { fn from(err: FileParseError) -> Error { Error::InvalidUrl(err) } } impl From for Error { fn from(err: ExistsError) -> Error { Error::Exists(err) } } impl From for Error { fn from(err: InfoError) -> Error { Error::Info(err) } } ================================================ FILE: src/action/mod.rs ================================================ pub mod debug; pub mod delete; pub mod download; pub mod exists; pub mod generate; #[cfg(feature = "history")] pub mod history; pub mod info; pub mod params; pub mod password; pub mod upload; pub mod version; use ffsend_api::action::version::{Error as VersionError, Version as ApiVersion}; use ffsend_api::api::DesiredVersion; use ffsend_api::client::Client; use ffsend_api::url::Url; use crate::config::API_VERSION_ASSUME; use crate::util::print_warning; /// Based on the given desired API version, select a version we can use. /// /// If the current desired version is set to the `DesiredVersion::Lookup` variant, this method /// will look up the server API version. It it's `DesiredVersion::Use` it will return and /// attempt to use the specified version. fn select_api_version( client: &Client, host: Url, desired: &mut DesiredVersion, ) -> Result<(), VersionError> { // Break if already specified if let DesiredVersion::Use(_) = desired { return Ok(()); } // TODO: only lookup if `DesiredVersion::Assume` after first operation attempt failed // Look up the version match ApiVersion::new(host).invoke(&client) { // Use the probed version Ok(v) => *desired = DesiredVersion::Use(v), // If unknown, just assume the default version Err(VersionError::Unknown) => { *desired = DesiredVersion::Use(API_VERSION_ASSUME); print_warning(format!( "server API version could not be determined, assuming v{}", API_VERSION_ASSUME, )); } // Propagate other errors Err(e) => return Err(e), } Ok(()) } ================================================ FILE: src/action/params.rs ================================================ use clap::ArgMatches; use ffsend_api::action::params::{Error as ParamsError, Params as ApiParams, ParamsDataBuilder}; use ffsend_api::file::remote_file::RemoteFile; use super::select_api_version; use crate::client::create_config; use crate::cmd::matcher::{main::MainMatcher, params::ParamsMatcher, Matcher}; use crate::error::ActionError; #[cfg(feature = "history")] use crate::history_tool; use crate::util::{ensure_owner_token, print_success}; /// A file parameters action. pub struct Params<'a> { cmd_matches: &'a ArgMatches<'a>, } impl<'a> Params<'a> { /// Construct a new parameters action. pub fn new(cmd_matches: &'a ArgMatches<'a>) -> Self { Self { cmd_matches } } /// Invoke the parameters action. // TODO: create a trait for this method pub fn invoke(&self) -> Result<(), ActionError> { // Create the command matchers let matcher_main = MainMatcher::with(self.cmd_matches).unwrap(); let matcher_params = ParamsMatcher::with(self.cmd_matches).unwrap(); // Get the share URL and the host // TODO: derive host through helper function let url = matcher_params.url(); let mut host = url.clone(); host.set_path(""); host.set_query(None); host.set_fragment(None); // Create a reqwest client let client_config = create_config(&matcher_main); let client = client_config.client(false); // Determine the API version to use let mut desired_version = matcher_main.api(); select_api_version(&client, host, &mut desired_version)?; let api_version = desired_version.version().unwrap(); // Parse the remote file based on the share URL, derive the owner token from history let mut file = RemoteFile::parse_url(url, matcher_params.owner())?; #[cfg(feature = "history")] history_tool::derive_file_properties(&matcher_main, &mut file); // Ensure the owner token is set ensure_owner_token(file.owner_token_mut(), &matcher_main, false); // We don't authenticate for now let auth = false; // Build the parameters data object let data = ParamsDataBuilder::default() .download_limit( matcher_params .download_limit(&matcher_main, api_version, auth) .map(|d| d as u8), ) .build() .unwrap(); // TODO: make sure the data isn't empty // Execute an password action let result = ApiParams::new(&file, data, None).invoke(&client); if let Err(ParamsError::Expired) = result { // Remove the file from the history if expired #[cfg(feature = "history")] history_tool::remove(&matcher_main, &file); } result?; // Update the history #[cfg(feature = "history")] history_tool::add(&matcher_main, file, true); // Print a success message print_success("Parameters set"); Ok(()) } } ================================================ FILE: src/action/password.rs ================================================ use clap::ArgMatches; use ffsend_api::action::password::{Error as PasswordError, Password as ApiPassword}; use ffsend_api::file::remote_file::RemoteFile; use prettytable::{format::FormatBuilder, Cell, Row, Table}; use crate::client::create_config; use crate::cmd::matcher::{main::MainMatcher, password::PasswordMatcher, Matcher}; use crate::error::ActionError; #[cfg(feature = "history")] use crate::history_tool; use crate::util::{ensure_owner_token, print_success}; /// A file password action. pub struct Password<'a> { cmd_matches: &'a ArgMatches<'a>, } impl<'a> Password<'a> { /// Construct a new password action. pub fn new(cmd_matches: &'a ArgMatches<'a>) -> Self { Self { cmd_matches } } /// Invoke the password action. // TODO: create a trait for this method pub fn invoke(&self) -> Result<(), ActionError> { // Create the command matchers let matcher_main = MainMatcher::with(self.cmd_matches).unwrap(); let matcher_password = PasswordMatcher::with(self.cmd_matches).unwrap(); // Get the share URL let url = matcher_password.url(); // Create a reqwest client let client_config = create_config(&matcher_main); let client = client_config.client(false); // Parse the remote file based on the share URL, derive the owner token from history let mut file = RemoteFile::parse_url(url, matcher_password.owner())?; #[cfg(feature = "history")] history_tool::derive_file_properties(&matcher_main, &mut file); // Ensure the owner token is set ensure_owner_token(file.owner_token_mut(), &matcher_main, false); // Get the password to use and whether it was generated let (password, password_generated) = matcher_password.password(); // Execute an password action let result = ApiPassword::new(&file, &password, None).invoke(&client); if let Err(PasswordError::Expired) = result { // Remove the file from the history if expired #[cfg(feature = "history")] history_tool::remove(&matcher_main, &file); } result?; // Add the file to the history #[cfg(feature = "history")] history_tool::add(&matcher_main, file, true); // Print the passphrase if one was generated if password_generated { let mut table = Table::new(); table.set_format(FormatBuilder::new().padding(0, 2).build()); table.add_row(Row::new(vec![ Cell::new("Passphrase:"), Cell::new(&password), ])); table.printstd(); } // Print a success message print_success("Password set"); Ok(()) } } ================================================ FILE: src/action/upload.rs ================================================ use std::env::current_dir; use std::fs; use std::io::{Error as IoError, Write}; use std::path::Path; #[cfg(feature = "archive")] use std::path::PathBuf; #[cfg(feature = "archive")] use std::process::exit; use std::sync::{Arc, Mutex}; use clap::ArgMatches; use failure::Fail; use ffsend_api::action::params::ParamsDataBuilder; use ffsend_api::action::upload::{Error as UploadError, Upload as ApiUpload}; use ffsend_api::action::version::Error as VersionError; use ffsend_api::config::{upload_size_max, UPLOAD_SIZE_MAX_RECOMMENDED}; use ffsend_api::pipe::ProgressReporter; use pathdiff::diff_paths; use prettytable::{format::FormatBuilder, Cell, Row, Table}; #[cfg(feature = "qrcode")] use qr2term::print_qr; use tempfile::{Builder as TempBuilder, NamedTempFile}; use super::select_api_version; #[cfg(feature = "archive")] use crate::archive::archiver::Archiver; use crate::client::create_config; use crate::cmd::matcher::{MainMatcher, Matcher, UploadMatcher}; #[cfg(feature = "history")] use crate::history_tool; use crate::progress::ProgressBar; #[cfg(feature = "urlshorten")] use crate::urlshorten; #[cfg(feature = "clipboard")] use crate::util::set_clipboard; use crate::util::{ format_bytes, open_url, print_error, print_error_msg, prompt_yes, quit, quit_error_msg, rand_alphanum_string, stdin_read_file, ErrorHintsBuilder, StdinErr, }; /// A file upload action. pub struct Upload<'a> { cmd_matches: &'a ArgMatches<'a>, } impl<'a> Upload<'a> { /// Construct a new upload action. pub fn new(cmd_matches: &'a ArgMatches<'a>) -> Self { Self { cmd_matches } } /// Invoke the upload action. // TODO: create a trait for this method pub fn invoke(&self) -> Result<(), Error> { // Create the command matchers let matcher_main = MainMatcher::with(self.cmd_matches).unwrap(); let matcher_upload = UploadMatcher::with(self.cmd_matches).unwrap(); // The file name to use #[allow(unused_mut)] let mut file_name = matcher_upload.name().map(|s| s.to_owned()); // The selected files let mut files = matcher_upload.files(); // If file is `-`, upload from stdin // TODO: write stdin directly to file, or directly to upload buffer let mut tmp_stdin: Option = None; if files.len() == 1 && files[0] == "-" { // Obtain data from stdin let data = stdin_read_file(!matcher_main.quiet()).map_err(Error::Stdin)?; // Create temporary stdin buffer file tmp_stdin = Some( TempBuilder::new() .prefix(&format!(".{}-stdin-", crate_name!())) .tempfile() .map_err(Error::StdinTempFile)?, ); let file = tmp_stdin.as_ref().unwrap(); // Fill temporary file with data, update list of files we upload, suggest name file.as_file() .write_all(&data) .map_err(Error::StdinTempFile)?; files = vec![file .path() .to_str() .expect("failed to obtain file name for stdin buffer file")]; file_name = file_name.or_else(|| Some("stdin.txt".into())); } // Get API parameters #[allow(unused_mut)] let mut paths: Vec<_> = files .into_iter() .map(|p| Path::new(p).to_path_buf()) .collect(); let mut path = Path::new(paths.first().unwrap()).to_path_buf(); let host = matcher_upload.host(); // All paths must exist // TODO: ensure the file exists and is accessible for path in &paths { if !path.exists() { quit_error_msg( format!("the path '{}' does not exist", path.to_str().unwrap_or("?")), ErrorHintsBuilder::default().build().unwrap(), ); } } // A temporary archive file, only used when archiving // The temporary file is stored here, to ensure it's lifetime exceeds the upload process #[allow(unused_mut)] #[cfg(feature = "archive")] let mut tmp_archive: Option = None; #[cfg(feature = "archive")] { // Determine whether to archive, we must archive for multiple files/directory let mut archive = matcher_upload.archive(); if !archive { if paths.len() > 1 { if prompt_yes( "You've selected multiple files, only a single file may be uploaded.\n\ Archive the files into a single file?", Some(true), &matcher_main, ) { archive = true; } else { exit(1); } } else if path.is_dir() { if prompt_yes( "You've selected a directory, only a single file may be uploaded.\n\ Archive the directory into a single file?", Some(true), &matcher_main, ) { archive = true; } else { exit(1); } } } // Archive the selected file or directory if archive { eprintln!("Archiving..."); let archive_extention = ".tar"; // Create a new temporary file to write the archive to tmp_archive = Some( TempBuilder::new() .prefix(&format!(".{}-archive-", crate_name!())) .suffix(archive_extention) .tempfile() .map_err(ArchiveError::TempFile)?, ); if let Some(tmp_archive) = &tmp_archive { // Get the path, and the actual file let archive_path = tmp_archive.path().to_path_buf(); let archive_file = tmp_archive .as_file() .try_clone() .map_err(ArchiveError::CloneHandle)?; // Select the file name to use if not set if file_name.is_none() { // Derive name from given file if paths.len() == 1 { file_name = Some( path.canonicalize() .map_err(|err| ArchiveError::FileName(Some(err)))? .file_name() .ok_or(ArchiveError::FileName(None))? .to_str() .map(|s| s.to_owned()) .ok_or(ArchiveError::FileName(None))?, ); } else { // Unable to derive file name from paths, generate random file_name = Some(format!("ffsend-archive-{}", rand_alphanum_string(8))); } } // Get the current working directory, including working directory as highest possible root, canonicalize it let working_dir = current_dir().expect("failed to get current working directory"); let shared_dir = { let mut paths = paths.clone(); paths.push(working_dir.clone()); match shared_dir(paths) { Some(p) => p, None => quit_error_msg( "when archiving, all files must be within a same directory", ErrorHintsBuilder::default().verbose(false).build().unwrap(), ), } }; // Build an archiver, append each file let mut archiver = Archiver::new(archive_file); for path in &paths { // Canonicalize the path let mut path = Path::new(path).to_path_buf(); if let Ok(p) = path.canonicalize() { path = p; } // Find relative name to share dir, used to derive name from let name = diff_paths(&path, &shared_dir) .expect("failed to determine relative path of file to archive"); let name = name.to_str().expect("failed to get file path"); // Add file to archiver archiver .append_path(name, &path) .map_err(ArchiveError::AddFile)?; } // Finish the archival process, writes the archive file archiver.finish().map_err(ArchiveError::Write)?; // Append archive extension to name, set to upload archived file if let Some(ref mut file_name) = file_name { file_name.push_str(archive_extention); } path = archive_path; paths.clear(); } } } // Quit with error when uploading multiple files or directory, if we cannot archive #[cfg(not(feature = "archive"))] { if paths.len() > 1 { quit_error_msg( "uploading multiple files is not supported, ffsend must be compiled with 'archive' feature for this", ErrorHintsBuilder::default() .verbose(false) .build() .unwrap(), ); } if path.is_dir() { quit_error_msg( "uploading a directory is not supported, ffsend must be compiled with 'archive' feature for this", ErrorHintsBuilder::default() .verbose(false) .build() .unwrap(), ); } } // Create a reqwest client capable for uploading files let client_config = create_config(&matcher_main); let client = client_config.clone().client(false); // Determine the API version to use let mut desired_version = matcher_main.api(); select_api_version(&client, host.clone(), &mut desired_version)?; let api_version = desired_version.version().unwrap(); // We do not authenticate for now let auth = false; // TODO: extract this into external function { // Determine the max file size // TODO: set false parameter to authentication state let max_size = upload_size_max(api_version, auth); // Get the file size, fail on empty files, warn about large files if let Ok(size) = path.metadata().map(|m| m.len()) { // Enforce files not being 0 bytes if size == 0 && !matcher_main.force() { quit_error_msg( "uploading a file with a size of 0 bytes is not supported", ErrorHintsBuilder::default() .force(true) .verbose(false) .build() .unwrap(), ) } // Enforce maximum file size if size > max_size && !matcher_main.force() { // The file is too large, show an error and quit quit_error_msg( format!( "the file size is {}, bigger than the maximum allowed of {}", format_bytes(size), format_bytes(max_size), ), ErrorHintsBuilder::default() .force(true) .verbose(false) .build() .unwrap(), ); } // Enforce maximum recommended size if size > UPLOAD_SIZE_MAX_RECOMMENDED && !matcher_main.force() { // The file is larger than the recommended maximum, warn eprintln!( "The file size is {}, bigger than the recommended maximum of {}", format_bytes(size), format_bytes(UPLOAD_SIZE_MAX_RECOMMENDED), ); // Prompt the user to continue, quit if the user answered no if !prompt_yes("Continue uploading?", Some(true), &matcher_main) { eprintln!("Upload cancelled"); quit(); } } } else { print_error_msg("failed to check the file size, ignoring"); } } // TODO: assert max expiry time for file // Create a reqwest client capable for uploading files let transfer_client = client_config.client(true); // Create a progress bar reporter let progress_bar = Arc::new(Mutex::new(ProgressBar::new_upload())); // Build a parameters object to set for the file let params = { // Build the parameters data object let params = ParamsDataBuilder::default() .download_limit( matcher_upload .download_limit(&matcher_main, api_version, auth) .map(|d| d as u8), ) .expiry_time(matcher_upload.expiry_time(&matcher_main, api_version, auth)) .build() .unwrap(); // Wrap the data in an option if not empty if params.is_empty() { None } else { Some(params) } }; // Build the progress reporter let progress_reporter: Arc> = progress_bar; // Get the password to use and whether it was generated let password = matcher_upload.password(); let (password, password_generated) = password.map(|(p, g)| (Some(p), g)).unwrap_or((None, false)); // Execute an upload action, obtain the URL let reporter = if !matcher_main.quiet() { Some(&progress_reporter) } else { None }; let file = ApiUpload::new( api_version, host, path.clone(), file_name, password.clone(), params, ) .invoke(&transfer_client, reporter)?; #[allow(unused_mut)] let mut url = file.download_url(true); // Shorten the share URL if requested, prompt the user to confirm #[cfg(feature = "urlshorten")] { if matcher_upload.shorten() { if prompt_yes("URL shortening is a security risk. This shares the secret URL with a 3rd party.\nDo you want to shorten the share URL?", Some(false), &matcher_main) { match urlshorten::shorten_url(&client, &url) { Ok(short) => url = short, Err(err) => print_error( err.context("failed to shorten share URL, ignoring") .compat(), ), } } } } // Report the result if !matcher_main.quiet() { // Create a table let mut table = Table::new(); table.set_format(FormatBuilder::new().padding(0, 2).build()); // Show the original URL when shortening, verbose and different #[cfg(feature = "urlshorten")] { let full_url = file.download_url(true); if matcher_main.verbose() && matcher_upload.shorten() && url != full_url { table.add_row(Row::new(vec![ Cell::new("Full share link:"), Cell::new(full_url.as_str()), ])); } } if matcher_main.verbose() { // Show the share URL table.add_row(Row::new(vec![ Cell::new("Share link:"), Cell::new(url.as_str()), ])); // Show a generate passphrase if password_generated { table.add_row(Row::new(vec![ Cell::new("Passphrase:"), Cell::new(&password.unwrap_or("?".into())), ])); } // Show the owner token table.add_row(Row::new(vec![ Cell::new("Owner token:"), Cell::new(file.owner_token().unwrap()), ])); } else { table.add_row(Row::new(vec![Cell::new(url.as_str())])); // Show a generate passphrase if password_generated { table.add_row(Row::new(vec![Cell::new(&password.unwrap_or("?".into()))])); } } table.printstd(); } else { println!("{}", url); } // Add the file to the history manager #[cfg(feature = "history")] history_tool::add(&matcher_main, file.clone(), false); // Open the URL in the browser if matcher_upload.open() { if let Err(err) = open_url(&url) { print_error(err.context("failed to open the share link in the browser")); }; } // Copy the URL or command to the user's clipboard #[cfg(feature = "clipboard")] { if let Some(copy_mode) = matcher_upload.copy() { if let Err(err) = set_clipboard(copy_mode.build(url.as_str())) { print_error( err.context("failed to copy the share link to the clipboard, ignoring"), ); } } } // Print a QR code for the share URL #[cfg(feature = "qrcode")] { if matcher_upload.qrcode() { if let Err(err) = print_qr(url.as_str()) { print_error(err.context("failed to print QR code, ignoring").compat()); } } } // Close the temporary stdin buffer file, to ensure it's removed if let Some(tmp_stdin) = tmp_stdin.take() { if let Err(err) = tmp_stdin.close() { print_error( err.context("failed to clean up temporary stdin buffer file, ignoring") .compat(), ); } } #[cfg(feature = "archive")] { // Close the temporary zip file, to ensure it's removed if let Some(tmp_archive) = tmp_archive.take() { if let Err(err) = tmp_archive.close() { print_error( err.context("failed to clean up temporary archive file, ignoring") .compat(), ); } } } // Delete local files after uploading if matcher_upload.delete() { for path in &paths { if path.is_file() { if let Err(err) = fs::remove_file(path) { print_error( Error::Delete(err) .context("failed to delete local file after upload, ignoring") .compat(), ); } } else { if let Err(err) = fs::remove_dir_all(path) { print_error( Error::Delete(err) .context("failed to delete local directory after upload, ignoring") .compat(), ); } } } } Ok(()) } } /// Find the deepest directory all given paths share. /// /// This function canonicalizes the paths, make sure the paths exist. /// /// Returns `None` if paths are using a different root. /// /// # Examples /// /// If the following paths are given: /// /// - `/home/user/git/ffsend/src` /// - `/home/user/git/ffsend/src/main.rs` /// - `/home/user/git/ffsend/Cargo.toml` /// /// The following is returned: /// /// `/home/user/git/ffsend` #[cfg(feature = "archive")] fn shared_dir(paths: Vec) -> Option { // Any path must be given if paths.is_empty() { return None; } // Build vector let c: Vec> = paths .into_iter() .map(|p| p.canonicalize().expect("failed to canonicalize path")) .map(|mut p| { // Start with parent if current path is file if p.is_file() { p = match p.parent() { Some(p) => p.to_path_buf(), None => return vec![], }; } // Build list of path buffers for each path component let mut items = vec![p]; #[allow(mutable_borrow_reservation_conflict)] while let Some(item) = items.last().unwrap().parent() { items.push(item.to_path_buf()); } // Reverse as we built it in the wrong order items.reverse(); items }) .collect(); // Find the index at which the paths are last shared at by walking through indices let i = (0..) .take_while(|i| { // Get path for first item, stop if none let base = &c[0].get(*i); if base.is_none() { return false; }; // All other paths must equal at this index c.iter().skip(1).all(|p| &p.get(*i) == base) }) .last(); // Find the shared path i.map(|i| c[0][i].to_path_buf()) } #[derive(Debug, Fail)] pub enum Error { /// Selecting the API version to use failed. // TODO: enable `api` hint! #[fail(display = "failed to select API version to use")] Version(#[cause] VersionError), /// An error occurred while archiving the file to upload. #[cfg(feature = "archive")] #[fail(display = "failed to archive file to upload")] Archive(#[cause] ArchiveError), /// An error occurred while uploading the file. #[fail(display = "")] Upload(#[cause] UploadError), /// An error occurred while deleting a local file after upload. #[fail(display = "failed to delete local file")] Delete(#[cause] IoError), /// An error occurred while reading data from stdin. #[fail(display = "failed to read data from stdin")] Stdin(#[cause] StdinErr), /// An error occurred while creating the temporary stdin file. #[fail(display = "failed to create temporary stdin buffer file")] StdinTempFile(#[cause] IoError), } impl From for Error { fn from(err: VersionError) -> Error { Error::Version(err) } } #[cfg(feature = "archive")] impl From for Error { fn from(err: ArchiveError) -> Error { Error::Archive(err) } } impl From for Error { fn from(err: UploadError) -> Error { Error::Upload(err) } } #[cfg(feature = "archive")] #[derive(Debug, Fail)] pub enum ArchiveError { /// An error occurred while creating the temporary archive file. #[fail(display = "failed to create temporary archive file")] TempFile(#[cause] IoError), /// An error occurred while internally cloning the handle to the temporary archive file. #[fail(display = "failed to clone handle to temporary archive file")] CloneHandle(#[cause] IoError), /// Failed to infer a file name for the archive. #[fail(display = "failed to infer a file name for the archive")] FileName(Option), /// Failed to add a file or directory to the archive. #[fail(display = "failed to add file to the archive")] AddFile(#[cause] IoError), /// Failed to write the created archive to the disk. #[fail(display = "failed to write archive to disk")] Write(#[cause] IoError), } ================================================ FILE: src/action/version.rs ================================================ use clap::ArgMatches; use ffsend_api::action::version::{Error as VersionError, Version as ApiVersion}; use crate::client::create_config; use crate::cmd::matcher::main::MainMatcher; use crate::cmd::matcher::{version::VersionMatcher, Matcher}; use crate::error::ActionError; /// A file version action. pub struct Version<'a> { cmd_matches: &'a ArgMatches<'a>, } impl<'a> Version<'a> { /// Construct a new version action. pub fn new(cmd_matches: &'a ArgMatches<'a>) -> Self { Self { cmd_matches } } /// Invoke the version action. // TODO: create a trait for this method pub fn invoke(&self) -> Result<(), ActionError> { // Create the command matchers let matcher_version = VersionMatcher::with(self.cmd_matches).unwrap(); let matcher_main = MainMatcher::with(self.cmd_matches).unwrap(); // Get the host let host = matcher_version.host(); // Create a reqwest client let client_config = create_config(&matcher_main); let client = client_config.client(false); // Make sure the file version let response = ApiVersion::new(host).invoke(&client); // Print the result match response { Ok(v) => println!("API version: {}", v), Err(VersionError::Unknown) => println!("Version: unknown"), Err(VersionError::Unsupported(v)) => println!("Version: {} (unsupported)", v), Err(e) => return Err(e.into()), } Ok(()) } } #[derive(Debug, Fail)] pub enum Error { /// An error occurred while attempting to determine the Send server version. #[fail(display = "failed to check the server version")] Version(#[cause] VersionError), } impl From for Error { fn from(err: VersionError) -> Error { Error::Version(err) } } ================================================ FILE: src/archive/archive.rs ================================================ use std::io::{Error as IoError, Read}; use std::path::Path; use tar::Archive as TarArchive; pub type Result = ::std::result::Result; pub struct Archive { /// The tar archive inner: TarArchive, } impl Archive { /// Construct a new archive extractor. pub fn new(reader: R) -> Archive { Archive { inner: TarArchive::new(reader), } } /// Extract the archive to the given destination. pub fn extract>(&mut self, destination: P) -> Result<()> { self.inner.unpack(destination) } } ================================================ FILE: src/archive/archiver.rs ================================================ use std::fs::File; use std::io::{Error as IoError, Write}; use std::path::Path; use tar::Builder as TarBuilder; pub type Result = ::std::result::Result; pub struct Archiver { /// The tar builder. inner: TarBuilder, } impl Archiver { /// Construct a new archive builder. pub fn new(writer: W) -> Archiver { Archiver { inner: TarBuilder::new(writer), } } /// Add the entry at the given `src` path, to the given relative `path` in the archive. /// /// If a directory path is given, the whole directory including it's contents is added to the /// archive. /// /// If no entry exists at the given `src_path`, an error is returned. pub fn append_path(&mut self, path: P, src_path: Q) -> Result<()> where P: AsRef, Q: AsRef, { // Append the path as file or directory if src_path.as_ref().is_file() { self.append_file(path, &mut File::open(src_path)?) } else if src_path.as_ref().is_dir() { self.append_dir(path, src_path) } else { // TODO: return a IO NotFound error here! panic!("Unable to append path to archive, not a file or directory"); } } /// Append a file to the archive builder. pub fn append_file

(&mut self, path: P, file: &mut File) -> Result<()> where P: AsRef, { self.inner.append_file(path, file) } /// Append a directory to the archive builder. // TODO: Define a flag to add recursively or not pub fn append_dir(&mut self, path: P, src_path: Q) -> Result<()> where P: AsRef, Q: AsRef, { self.inner.append_dir_all(path, src_path) } // TODO: some description pub fn finish(mut self) -> Result<()> { self.inner.finish() } } ================================================ FILE: src/archive/mod.rs ================================================ pub mod archive; pub mod archiver; ================================================ FILE: src/client.rs ================================================ use std::time::Duration; use ffsend_api::client::{ClientConfig, ClientConfigBuilder}; use crate::cmd::matcher::MainMatcher; /// Create a client configuration for ffsend actions. /// /// A client configuration allows you to build a client, which must be passed to ffsend API /// actions. // TODO: properly handle errors, do not unwrap pub fn create_config(matcher_main: &MainMatcher) -> ClientConfig { // TODO: configure HTTP authentication properties ClientConfigBuilder::default() .timeout(to_duration(matcher_main.timeout())) .transfer_timeout(to_duration(matcher_main.transfer_timeout())) .basic_auth(matcher_main.basic_auth()) .build() .expect("failed to create network client configuration") } /// Convert the given number of seconds into an optional duration, used for clients. pub fn to_duration(secs: u64) -> Option { if secs > 0 { Some(Duration::from_secs(secs)) } else { None } } ================================================ FILE: src/cmd/arg/api.rs ================================================ use clap::{Arg, ArgMatches}; use ffsend_api::api::{DesiredVersion, Version}; use super::{CmdArg, CmdArgOption}; use crate::config::API_VERSION_DESIRED_DEFAULT; use crate::util::{quit_error_msg, ErrorHints}; /// The api argument. pub struct ArgApi {} impl CmdArg for ArgApi { fn name() -> &'static str { "api" } fn build<'b, 'c>() -> Arg<'b, 'c> { Arg::with_name("api") .long("api") .short("A") .value_name("VERSION") .env("FFSEND_API") .hide_env_values(true) .global(true) .help("Server API version to use, '-' to lookup") .long_help( "Server API version to use, one of:\n\ 2, 3: Send API versions\n\ auto, -: probe server to determine\ ", ) } } impl<'a> CmdArgOption<'a> for ArgApi { type Value = DesiredVersion; fn value<'b: 'a>(matches: &'a ArgMatches<'b>) -> Self::Value { // Get the version string let version = match Self::value_raw(matches) { Some(version) => version, None => return API_VERSION_DESIRED_DEFAULT, }; // Parse the lookup version string if is_auto(version) { return DesiredVersion::Lookup; } // Parse the given API version match Version::parse(version) { Ok(version) => DesiredVersion::Use(version), Err(_) => quit_error_msg( "failed to determine given server API version, version unknown", ErrorHints::default(), ), } } } /// Check whether the given API version argument means we've to probe the server for the proper /// version. fn is_auto(arg: &str) -> bool { let arg = arg.trim().to_lowercase(); arg == "a" || arg == "auto" || arg == "-" } ================================================ FILE: src/cmd/arg/basic_auth.rs ================================================ use clap::{Arg, ArgMatches}; use super::{CmdArg, CmdArgOption}; /// The basicauth argument. pub struct ArgBasicAuth {} impl CmdArg for ArgBasicAuth { fn name() -> &'static str { "basic-auth" } fn build<'b, 'c>() -> Arg<'b, 'c> { Arg::with_name("basic-auth") .long("basic-auth") .alias("basic-authentication") .alias("http-basic-authentication") .alias("http-basic-auth") .value_name("USER:PASSWORD") .env("FFSEND_BASIC_AUTH") .hide_env_values(true) .global(true) .help("Protected proxy HTTP basic authentication credentials (not FxA)") } } impl<'a> CmdArgOption<'a> for ArgBasicAuth { type Value = Option<(String, Option)>; fn value<'b: 'a>(matches: &'a ArgMatches<'b>) -> Self::Value { // Get the authentication credentials let raw = match Self::value_raw(matches) { Some(raw) => raw, None => return None, }; // Split the properties let mut iter = raw.splitn(2, ':'); Some(( iter.next().unwrap_or("").to_owned(), iter.next().map(|pass| pass.to_owned()), )) } } ================================================ FILE: src/cmd/arg/download_limit.rs ================================================ use clap::{Arg, ArgMatches}; use ffsend_api::api::Version as ApiVersion; use ffsend_api::config::downloads_max; use super::{CmdArg, CmdArgFlag, CmdArgOption}; use crate::cmd::matcher::MainMatcher; use crate::util::{highlight, prompt_yes, quit}; /// The download limit argument. pub struct ArgDownloadLimit {} impl ArgDownloadLimit { pub fn value_checked<'a>( matches: &ArgMatches<'a>, main_matcher: &MainMatcher, api_version: ApiVersion, auth: bool, ) -> Option { // Get the download value let mut downloads = Self::value(matches)?; // Get number of allowed downloads, return if allowed or when forcing let allowed = downloads_max(api_version, auth); if allowed.contains(&downloads) || main_matcher.force() { return Some(downloads); } // Prompt the user the specified downloads limit is invalid let allowed_str = allowed .iter() .map(|value| format!("{}", value)) .collect::>() .join(", "); eprintln!("The downloads limit must be one of: {}", allowed_str); if auth { eprintln!("Use '{}' to force", highlight("--force")); } else { eprintln!( "Use '{}' to force, authenticate for higher limits", highlight("--force") ); } // Ask to use closest limit, quit if user cancelled let closest = closest(allowed, downloads); if !prompt_yes( &format!("Would you like to limit downloads to {} instead?", closest), None, main_matcher, ) { quit(); } downloads = closest; Some(downloads) } } impl CmdArg for ArgDownloadLimit { fn name() -> &'static str { "download-limit" } fn build<'b, 'c>() -> Arg<'b, 'c> { Arg::with_name("download-limit") .long("download-limit") .short("d") .alias("downloads") .alias("download") .value_name("COUNT") .env("FFSEND_DOWNLOAD_LIMIT") .help("The file download limit") } } impl CmdArgFlag for ArgDownloadLimit {} impl<'a> CmdArgOption<'a> for ArgDownloadLimit { type Value = Option; fn value<'b: 'a>(matches: &'a ArgMatches<'b>) -> Self::Value { // TODO: do not unwrap, report an error Self::value_raw(matches).map(|d| d.parse::().expect("invalid download limit")) } } /// Find the closest value to `current` in the given `values` range. fn closest(values: &[usize], current: usize) -> usize { // Own the values, sort and reverse, start with biggest first let mut values = values.to_vec(); values.sort_unstable(); // Find the closest value, return it *values .iter() .rev() .map(|value| (value, (current as i64 - *value as i64).abs())) .min_by_key(|value| value.1) .expect("failed to find closest value, none given") .0 } ================================================ FILE: src/cmd/arg/expiry_time.rs ================================================ use chrono::Duration; use clap::{Arg, ArgMatches}; use failure::Fail; use ffsend_api::api::Version as ApiVersion; use ffsend_api::config::expiry_max; use super::{CmdArg, CmdArgFlag, CmdArgOption}; use crate::cmd::matcher::MainMatcher; use crate::util::{ format_duration, highlight, parse_duration, prompt_yes, quit, quit_error, ErrorHints, }; /// The download limit argument. pub struct ArgExpiryTime {} impl ArgExpiryTime { pub fn value_checked<'a>( matches: &ArgMatches<'a>, main_matcher: &MainMatcher, api_version: ApiVersion, auth: bool, ) -> Option { // Get the expiry time value let mut expiry = Self::value(matches)?; // Get expiry time, return if allowed or when forcing let max = *expiry_max(api_version, auth).into_iter().max().unwrap(); if expiry <= max || main_matcher.force() { return Some(expiry); } // Define function to format seconds let format_secs = |secs: usize| format_duration(Duration::seconds(secs as i64)); // Prompt the user the specified expiry time is invalid eprintln!( "The expiry time must equal to or less than: {}", format_secs(max), ); if auth { eprintln!("Use '{}' to force", highlight("--force")); } else { eprintln!( "Use '{}' to force, authenticate for higher limits", highlight("--force") ); } // Ask to use maximum expiry time instead, quit if user cancelled if !prompt_yes( &format!( "Would you like to set expiry time to {} instead?", format_secs(max), ), None, main_matcher, ) { quit(); } expiry = max; Some(expiry) } } impl CmdArg for ArgExpiryTime { fn name() -> &'static str { "expiry-time" } fn build<'b, 'c>() -> Arg<'b, 'c> { Arg::with_name("expiry-time") .long("expiry-time") .short("e") .alias("expire") .alias("expiry") .value_name("TIME") .env("FFSEND_EXPIRY_TIME") .help("The file expiry time") } } impl CmdArgFlag for ArgExpiryTime {} impl<'a> CmdArgOption<'a> for ArgExpiryTime { type Value = Option; fn value<'b: 'a>(matches: &'a ArgMatches<'b>) -> Self::Value { Self::value_raw(matches).map(|t| match parse_duration(t) { Ok(seconds) => seconds, Err(err) => quit_error( err.context("specified invalid file expiry time"), ErrorHints::default(), ), }) } } ================================================ FILE: src/cmd/arg/gen_passphrase.rs ================================================ use chbs; use clap::Arg; use super::{CmdArg, CmdArgFlag}; /// The passphrase generation argument. pub struct ArgGenPassphrase {} impl ArgGenPassphrase { /// Generate a cryptographically secure passphrase that is easily /// remembered using diceware. pub fn gen_passphrase() -> String { chbs::passphrase() } } impl CmdArg for ArgGenPassphrase { fn name() -> &'static str { "gen-passphrase" } fn build<'b, 'c>() -> Arg<'b, 'c> { Arg::with_name("gen-passphrase") .long("gen-passphrase") .alias("gen-password") .alias("generate-passphrase") .alias("generate-password") .short("P") .conflicts_with("password") .help("Protect the file with a generated passphrase") } } impl CmdArgFlag for ArgGenPassphrase {} ================================================ FILE: src/cmd/arg/host.rs ================================================ use clap::{Arg, ArgMatches}; use failure::Fail; use ffsend_api::url::Url; use super::{CmdArg, CmdArgOption}; use crate::host::parse_host; use crate::util::{quit_error, ErrorHints}; /// The host argument. pub struct ArgHost {} impl CmdArg for ArgHost { fn name() -> &'static str { "host" } fn build<'b, 'c>() -> Arg<'b, 'c> { Arg::with_name("host") .long("host") .short("h") .value_name("URL") .default_value("https://send.vis.ee/") .env("FFSEND_HOST") .hide_env_values(true) .help("The remote host to upload to") } } impl<'a> CmdArgOption<'a> for ArgHost { type Value = Url; fn value<'b: 'a>(matches: &'a ArgMatches<'b>) -> Self::Value { // Get the URL let url = Self::value_raw(matches).expect("missing host"); // Parse the URL match parse_host(&url) { Ok(url) => url, Err(err) => quit_error( err.context("failed to parse the given host"), ErrorHints::default(), ), } } } ================================================ FILE: src/cmd/arg/mod.rs ================================================ pub mod api; pub mod basic_auth; pub mod download_limit; pub mod expiry_time; pub mod gen_passphrase; pub mod host; pub mod owner; pub mod password; pub mod url; // Re-export to arg module pub use self::api::ArgApi; pub use self::basic_auth::ArgBasicAuth; pub use self::download_limit::ArgDownloadLimit; pub use self::expiry_time::ArgExpiryTime; pub use self::gen_passphrase::ArgGenPassphrase; pub use self::host::ArgHost; pub use self::owner::ArgOwner; pub use self::password::ArgPassword; pub use self::url::ArgUrl; use clap::{Arg, ArgMatches}; /// A generic trait, for a reusable command argument struct. /// The `CmdArgFlag` and `CmdArgOption` traits further specify what kind of /// argument this is. pub trait CmdArg { /// Get the argument name that is used as main identifier. fn name() -> &'static str; /// Build the argument. fn build<'a, 'b>() -> Arg<'a, 'b>; } /// This `CmdArg` specification defines that this argument may be tested as /// flag. This will allow to test whether the flag is present in the given /// matches. pub trait CmdArgFlag: CmdArg { /// Check whether the argument is present in the given matches. fn is_present<'a>(matches: &ArgMatches<'a>) -> bool { matches.is_present(Self::name()) } } /// This `CmdArg` specification defines that this argument may be tested as /// option. This will allow to fetch the value of the argument. pub trait CmdArgOption<'a>: CmdArg { /// The type of the argument value. type Value; /// Get the argument value. fn value<'b: 'a>(matches: &'a ArgMatches<'b>) -> Self::Value; /// Get the raw argument value, as a string reference. fn value_raw<'b: 'a>(matches: &'a ArgMatches<'b>) -> Option<&'a str> { matches.value_of(Self::name()) } } ================================================ FILE: src/cmd/arg/owner.rs ================================================ use clap::{Arg, ArgMatches}; use super::{CmdArg, CmdArgFlag, CmdArgOption}; use crate::cmd::matcher::{MainMatcher, Matcher}; use crate::util::prompt_owner_token; /// The owner argument. pub struct ArgOwner {} impl CmdArg for ArgOwner { fn name() -> &'static str { "owner" } fn build<'b, 'c>() -> Arg<'b, 'c> { Arg::with_name("owner") .long("owner") .short("o") .alias("owner-token") .value_name("TOKEN") .min_values(0) .max_values(1) .help("Specify the file owner token") } } impl CmdArgFlag for ArgOwner {} impl<'a> CmdArgOption<'a> for ArgOwner { type Value = Option; fn value<'b: 'a>(matches: &'a ArgMatches<'b>) -> Self::Value { // The owner token flag must be present if !Self::is_present(matches) { return None; } // Get the owner token from the argument if set match Self::value_raw(matches) { None => {} p => return p.map(|p| p.into()), } // Create a main matcher let matcher_main = MainMatcher::with(matches).unwrap(); // Prompt for the owner token // TODO: should this be optional? Some(prompt_owner_token(&matcher_main, false)) } } ================================================ FILE: src/cmd/arg/password.rs ================================================ use clap::{Arg, ArgMatches}; use super::{CmdArg, CmdArgFlag, CmdArgOption}; use crate::cmd::matcher::{MainMatcher, Matcher}; use crate::util::{check_empty_password, prompt_password}; /// The password argument. pub struct ArgPassword {} impl CmdArg for ArgPassword { fn name() -> &'static str { "password" } fn build<'b, 'c>() -> Arg<'b, 'c> { Arg::with_name("password") .long("password") .short("p") .value_name("PASSWORD") .min_values(0) .max_values(1) .help("Unlock a password protected file") } } impl CmdArgFlag for ArgPassword {} impl<'a> CmdArgOption<'a> for ArgPassword { type Value = Option; fn value<'b: 'a>(matches: &'a ArgMatches<'b>) -> Self::Value { // The password flag must be present if !Self::is_present(matches) { return None; } // Create a main matcher let matcher_main = MainMatcher::with(matches).unwrap(); // Get the password argument value, or prompt let password = match Self::value_raw(matches) { Some(password) => password.into(), None => prompt_password(&matcher_main, false).unwrap(), }; // Check for empty passwords check_empty_password(&password, &matcher_main); Some(password) } } ================================================ FILE: src/cmd/arg/url.rs ================================================ use clap::{Arg, ArgMatches}; use failure::Fail; use ffsend_api::url::Url; use super::{CmdArg, CmdArgOption}; use crate::host::parse_host; use crate::util::{quit_error, ErrorHints}; /// The URL argument. pub struct ArgUrl {} impl CmdArg for ArgUrl { fn name() -> &'static str { "URL" } fn build<'b, 'c>() -> Arg<'b, 'c> { Arg::with_name("URL") .required(true) .multiple(false) .help("The share URL") } } impl<'a> CmdArgOption<'a> for ArgUrl { type Value = Url; fn value<'b: 'a>(matches: &'a ArgMatches<'b>) -> Self::Value { // Get the URL let url = Self::value_raw(matches).expect("missing URL"); // Parse the URL match parse_host(&url) { Ok(url) => url, Err(err) => quit_error( err.context("failed to parse the given share URL"), ErrorHints::default(), ), } } } ================================================ FILE: src/cmd/handler.rs ================================================ #[cfg(feature = "infer-command")] use std::ffi::OsString; use clap::{App, AppSettings, Arg, ArgMatches}; use super::arg::{ArgApi, ArgBasicAuth, CmdArg}; #[cfg(feature = "history")] use super::matcher::HistoryMatcher; use super::matcher::{ DebugMatcher, DeleteMatcher, DownloadMatcher, ExistsMatcher, GenerateMatcher, InfoMatcher, Matcher, ParamsMatcher, PasswordMatcher, UploadMatcher, VersionMatcher, }; #[cfg(feature = "history")] use super::subcmd::CmdHistory; use super::subcmd::{ CmdDebug, CmdDelete, CmdDownload, CmdExists, CmdGenerate, CmdInfo, CmdParams, CmdPassword, CmdUpload, CmdVersion, }; #[cfg(feature = "infer-command")] use crate::config::INFER_COMMANDS; use crate::config::{CLIENT_TIMEOUT, CLIENT_TRANSFER_TIMEOUT}; #[cfg(feature = "history")] use crate::util::app_history_file_path_string; #[cfg(feature = "infer-command")] use crate::util::bin_name; use crate::util::parse_duration; #[cfg(feature = "history")] lazy_static! { /// The default history file static ref DEFAULT_HISTORY_FILE: String = app_history_file_path_string(); } lazy_static! { /// The default client timeout in seconds as a string static ref DEFAULT_TIMEOUT: String = format!("{}", CLIENT_TIMEOUT); /// The default client transfer timeout in seconds as a string static ref DEFAULT_TRANSFER_TIMEOUT: String = format!("{}", CLIENT_TRANSFER_TIMEOUT); /// The about notice in command output. static ref APP_ABOUT: String = format!( "{}\n\n\ The default public Send host is provided by Tim Visee, @timvisee.\n\ Please consider to donate and help keep it running: https://vis.ee/donate\ ", crate_description!(), ); } /// CLI argument handler. pub struct Handler<'a> { /// The CLI matches. matches: ArgMatches<'a>, } impl<'a: 'b, 'b> Handler<'a> { /// Build the application CLI definition. pub fn build() -> App<'a, 'b> { // Build the CLI application definition let app = App::new(crate_name!()) .version(crate_version!()) .author(crate_authors!()) .about(APP_ABOUT.as_str()) .after_help("This application is not affiliated with Firefox or Mozilla.") .global_setting(AppSettings::GlobalVersion) .global_setting(AppSettings::VersionlessSubcommands) // TODO: enable below command when it doesn't break `p` anymore. // .global_setting(AppSettings::InferSubcommands) .arg( Arg::with_name("force") .long("force") .short("f") .global(true) .help("Force the action, ignore warnings"), ) .arg( Arg::with_name("no-interact") .long("no-interact") .short("I") .alias("no-interactive") .alias("non-interactive") .global(true) .help("Not interactive, do not prompt"), ) .arg( Arg::with_name("yes") .long("yes") .short("y") .alias("assume-yes") .global(true) .help("Assume yes for prompts"), ) .arg( Arg::with_name("timeout") .long("timeout") .short("t") .alias("time") .global(true) .value_name("SECONDS") .help("Request timeout (0 to disable)") .default_value(&DEFAULT_TIMEOUT) .hide_default_value(true) .env("FFSEND_TIMEOUT") .hide_env_values(true) .validator(|arg| { parse_duration(&arg).map(drop).map_err(|_| { String::from( "Timeout time must be a positive number of seconds, or 0 to disable." ) }) }), ) .arg( Arg::with_name("transfer-timeout") .long("transfer-timeout") .short("T") .alias("trans-time") .alias("trans-timeout") .alias("transfer-time") .alias("time-trans") .alias("timeout-trans") .alias("time-transfer") .global(true) .value_name("SECONDS") .help("Transfer timeout (0 to disable)") .default_value(&DEFAULT_TRANSFER_TIMEOUT) .hide_default_value(true) .env("FFSEND_TRANSFER_TIMEOUT") .hide_env_values(true) .validator(|arg| { parse_duration(&arg).map(drop).map_err(|_| { String::from( "Timeout time must be a positive number of seconds, or 0 to disable." ) }) }), ) .arg( Arg::with_name("quiet") .long("quiet") .short("q") .global(true) .help("Produce output suitable for logging and automation"), ) .arg( Arg::with_name("verbose") .long("verbose") .short("v") .multiple(true) .global(true) .help("Enable verbose information and logging"), ) .arg(ArgApi::build()) .arg(ArgBasicAuth::build()) .subcommand(CmdDebug::build()) .subcommand(CmdDelete::build()) .subcommand(CmdDownload::build().display_order(2)) .subcommand(CmdExists::build()) .subcommand(CmdGenerate::build()) .subcommand(CmdInfo::build()) .subcommand(CmdParams::build()) .subcommand(CmdPassword::build()) .subcommand(CmdUpload::build().display_order(1)) .subcommand(CmdVersion::build()); // With history support, a flag for the history file and incognito mode #[cfg(feature = "history")] let app = app .arg( Arg::with_name("history") .long("history") .short("H") .value_name("FILE") .global(true) .help("Use the specified history file") .default_value(&DEFAULT_HISTORY_FILE) .hide_default_value(true) .env("FFSEND_HISTORY") .hide_env_values(true), ) .arg( Arg::with_name("incognito") .long("incognito") .short("i") .alias("incog") .alias("private") .alias("priv") .global(true) .help("Don't update local history for actions"), ) .subcommand(CmdHistory::build()); // Disable color usage if compiled without color support #[cfg(feature = "no-color")] let app = app.global_setting(AppSettings::ColorNever); app } /// Parse CLI arguments. pub fn parse() -> Handler<'a> { // Obtain the program arguments #[allow(unused_mut)] let mut args: Vec<_> = ::std::env::args_os().collect(); // Infer subcommand based on binary name #[cfg(feature = "infer-command")] Self::infer_subcommand(&mut args); // Build the application CLI definition, get the matches Handler { matches: Handler::build().get_matches_from(args), } } /// Infer subcommand when the binary has a predefined name, /// modifying the given program arguments. /// /// If no subcommand could be inferred, the `args` list leaves unchanged. /// See `crate::config::INFER_COMMANDS` for a list of commands. /// /// When the `ffsend` binary is called with such a name, the corresponding subcommand is /// automatically inserted as argument. This also works when calling binaries through symbolic /// or hard links. #[cfg(feature = "infer-command")] fn infer_subcommand(args: &mut Vec) { // Get the name of the called binary let name = bin_name(); // Infer subcommands for (bin, subcmd) in INFER_COMMANDS.iter() { if &name == bin { args.insert(1, subcmd.into()); break; } } } /// Get the raw matches. pub fn matches(&'a self) -> &'a ArgMatches { &self.matches } /// Get the debug sub command, if matched. pub fn debug(&'a self) -> Option { DebugMatcher::with(&self.matches) } /// Get the delete sub command, if matched. pub fn delete(&'a self) -> Option { DeleteMatcher::with(&self.matches) } /// Get the download sub command, if matched. pub fn download(&'a self) -> Option { DownloadMatcher::with(&self.matches) } /// Get the exists sub command, if matched. pub fn exists(&'a self) -> Option { ExistsMatcher::with(&self.matches) } /// Get the generate sub command, if matched. pub fn generate(&'a self) -> Option { GenerateMatcher::with(&self.matches) } /// Get the history sub command, if matched. #[cfg(feature = "history")] pub fn history(&'a self) -> Option { HistoryMatcher::with(&self.matches) } /// Get the info matcher, if that subcommand is entered. pub fn info(&'a self) -> Option { InfoMatcher::with(&self.matches) } /// Get the parameters sub command, if matched. pub fn params(&'a self) -> Option { ParamsMatcher::with(&self.matches) } /// Get the password sub command, if matched. pub fn password(&'a self) -> Option { PasswordMatcher::with(&self.matches) } /// Get the upload sub command, if matched. pub fn upload(&'a self) -> Option { UploadMatcher::with(&self.matches) } /// Get the version sub command, if matched. pub fn version(&'a self) -> Option { VersionMatcher::with(&self.matches) } } ================================================ FILE: src/cmd/matcher/debug.rs ================================================ use clap::ArgMatches; use ffsend_api::url::Url; use super::Matcher; use crate::cmd::arg::{ArgHost, CmdArgOption}; /// The debug command matcher. pub struct DebugMatcher<'a> { matches: &'a ArgMatches<'a>, } impl<'a: 'b, 'b> DebugMatcher<'a> { /// Get the host to upload to. /// /// This method parses the host into an `Url`. /// If the given host is invalid, /// the program will quit with an error message. pub fn host(&'a self) -> Url { ArgHost::value(self.matches) } } impl<'a> Matcher<'a> for DebugMatcher<'a> { fn with(matches: &'a ArgMatches) -> Option { matches .subcommand_matches("debug") .map(|matches| DebugMatcher { matches }) } } ================================================ FILE: src/cmd/matcher/delete.rs ================================================ use clap::ArgMatches; use ffsend_api::url::Url; use super::Matcher; use crate::cmd::arg::{ArgOwner, ArgUrl, CmdArgOption}; /// The delete command matcher. pub struct DeleteMatcher<'a> { matches: &'a ArgMatches<'a>, } impl<'a: 'b, 'b> DeleteMatcher<'a> { /// Get the file share URL. /// /// This method parses the URL into an `Url`. /// If the given URL is invalid, /// the program will quit with an error message. pub fn url(&'a self) -> Url { ArgUrl::value(self.matches) } /// Get the owner token. pub fn owner(&'a self) -> Option { // TODO: just return a string reference here? ArgOwner::value(self.matches).map(|token| token.to_owned()) } } impl<'a> Matcher<'a> for DeleteMatcher<'a> { fn with(matches: &'a ArgMatches) -> Option { matches .subcommand_matches("delete") .map(|matches| DeleteMatcher { matches }) } } ================================================ FILE: src/cmd/matcher/download.rs ================================================ use std::path::PathBuf; use clap::ArgMatches; use ffsend_api::url::Url; use super::Matcher; use crate::cmd::arg::{ArgPassword, ArgUrl, CmdArgOption}; #[cfg(feature = "archive")] use crate::util::env_var_present; /// The download command matcher. pub struct DownloadMatcher<'a> { matches: &'a ArgMatches<'a>, } impl<'a: 'b, 'b> DownloadMatcher<'a> { /// Get the file share URL. /// /// This method parses the URL into an `Url`. /// If the given URL is invalid, /// the program will quit with an error message. pub fn url(&'a self) -> Url { ArgUrl::value(self.matches) } /// Guess the file share host, based on the file share URL. /// /// See `Self::url`. pub fn guess_host(&'a self, url: Option) -> Url { let mut url = url.unwrap_or(self.url()); url.set_path(""); url.set_query(None); url.set_fragment(None); url } /// Get the password. /// `None` is returned if no password was specified. pub fn password(&'a self) -> Option { ArgPassword::value(self.matches) } /// The target file or directory to download the file to. /// If a directory is given, the file name of the original uploaded file /// will be used. pub fn output(&'a self) -> PathBuf { self.matches .value_of("output") .map(PathBuf::from) .unwrap_or_else(|| PathBuf::from("./")) } /// Check whether to extract an archived file. #[cfg(feature = "archive")] pub fn extract(&self) -> bool { self.matches.is_present("extract") || env_var_present("FFSEND_EXTRACT") } } impl<'a> Matcher<'a> for DownloadMatcher<'a> { fn with(matches: &'a ArgMatches) -> Option { matches .subcommand_matches("download") .map(|matches| DownloadMatcher { matches }) } } ================================================ FILE: src/cmd/matcher/exists.rs ================================================ use ffsend_api::url::Url; use clap::ArgMatches; use super::Matcher; use crate::cmd::arg::{ArgUrl, CmdArgOption}; /// The exists command matcher. pub struct ExistsMatcher<'a> { matches: &'a ArgMatches<'a>, } impl<'a: 'b, 'b> ExistsMatcher<'a> { /// Get the file share URL. /// /// This method parses the URL into an `Url`. /// If the given URL is invalid, /// the program will quit with an error message. pub fn url(&'a self) -> Url { ArgUrl::value(self.matches) } } impl<'a> Matcher<'a> for ExistsMatcher<'a> { fn with(matches: &'a ArgMatches) -> Option { matches .subcommand_matches("exists") .map(|matches| ExistsMatcher { matches }) } } ================================================ FILE: src/cmd/matcher/generate/completions.rs ================================================ use std::path::PathBuf; use std::str::FromStr; use clap::{ArgMatches, Shell}; use super::Matcher; /// The completions completions command matcher. pub struct CompletionsMatcher<'a> { matches: &'a ArgMatches<'a>, } impl<'a: 'b, 'b> CompletionsMatcher<'a> { /// Get the shells to generate completions for. pub fn shells(&'a self) -> Vec { // Get the raw list of shells let raw = self .matches .values_of("SHELL") .expect("no shells were given"); // Parse the list of shell names, deduplicate let mut shells: Vec<_> = raw .into_iter() .map(|name| name.trim().to_lowercase()) .map(|name| { if name == "all" { Shell::variants() .iter() .map(|name| name.to_string()) .collect() } else { vec![name] } }) .flatten() .collect(); shells.sort_unstable(); shells.dedup(); // Parse the shell names shells .into_iter() .map(|name| Shell::from_str(&name).expect("failed to parse shell name")) .collect() } /// The target directory to output the shell completion files to. pub fn output(&'a self) -> PathBuf { self.matches .value_of("output") .map(PathBuf::from) .unwrap_or_else(|| PathBuf::from("./")) } } impl<'a> Matcher<'a> for CompletionsMatcher<'a> { fn with(matches: &'a ArgMatches) -> Option { matches .subcommand_matches("generate")? .subcommand_matches("completions") .map(|matches| CompletionsMatcher { matches }) } } ================================================ FILE: src/cmd/matcher/generate/mod.rs ================================================ pub mod completions; use clap::ArgMatches; use super::Matcher; use completions::CompletionsMatcher; /// The generate command matcher. pub struct GenerateMatcher<'a> { root: &'a ArgMatches<'a>, _matches: &'a ArgMatches<'a>, } impl<'a: 'b, 'b> GenerateMatcher<'a> { /// Get the generate completions sub command, if matched. pub fn matcher_completions(&'a self) -> Option { CompletionsMatcher::with(&self.root) } } impl<'a> Matcher<'a> for GenerateMatcher<'a> { fn with(root: &'a ArgMatches) -> Option { root.subcommand_matches("generate") .map(|matches| GenerateMatcher { root, _matches: matches, }) } } ================================================ FILE: src/cmd/matcher/history.rs ================================================ use clap::ArgMatches; use failure::Fail; use ffsend_api::url::Url; use super::Matcher; use crate::host::parse_host; use crate::util::{quit_error, ErrorHints}; /// The history command matcher. pub struct HistoryMatcher<'a> { #[allow(unused)] matches: &'a ArgMatches<'a>, } impl<'a> HistoryMatcher<'a> { /// Check whether to clear all history. pub fn clear(&self) -> bool { self.matches.is_present("clear") } /// Check whether to remove a given entry from the history. /// /// This method parses the URL into an `Url`. /// If the given URL is invalid, /// the program will quit with an error message. pub fn rm(&'a self) -> Option { // Get the URL let url = self.matches.value_of("rm")?; // Parse the URL match parse_host(&url) { Ok(url) => Some(url), Err(err) => quit_error( err.context("failed to parse the given share URL"), ErrorHints::default(), ), } } } impl<'a> Matcher<'a> for HistoryMatcher<'a> { fn with(matches: &'a ArgMatches) -> Option { matches .subcommand_matches("history") .map(|matches| HistoryMatcher { matches }) } } ================================================ FILE: src/cmd/matcher/info.rs ================================================ use ffsend_api::url::Url; use clap::ArgMatches; use super::Matcher; use crate::cmd::arg::{ArgOwner, ArgPassword, ArgUrl, CmdArgOption}; /// The info command matcher. pub struct InfoMatcher<'a> { matches: &'a ArgMatches<'a>, } impl<'a: 'b, 'b> InfoMatcher<'a> { /// Get the file share URL. /// /// This method parses the URL into an `Url`. /// If the given URL is invalid, /// the program will quit with an error message. pub fn url(&'a self) -> Url { ArgUrl::value(self.matches) } /// Get the owner token. pub fn owner(&'a self) -> Option { // TODO: just return a string reference here? ArgOwner::value(self.matches).map(|token| token.to_owned()) } /// Get the password. /// `None` is returned if no password was specified. pub fn password(&'a self) -> Option { ArgPassword::value(self.matches) } } impl<'a> Matcher<'a> for InfoMatcher<'a> { fn with(matches: &'a ArgMatches) -> Option { matches .subcommand_matches("info") .map(|matches| InfoMatcher { matches }) } } ================================================ FILE: src/cmd/matcher/main.rs ================================================ #[cfg(feature = "history")] use std::path::PathBuf; use clap::ArgMatches; use ffsend_api::api::DesiredVersion; use super::Matcher; use crate::cmd::arg::{ArgApi, ArgBasicAuth, CmdArgOption}; use crate::util::{env_var_present, parse_duration}; #[cfg(feature = "history")] use crate::util::{quit_error_msg, ErrorHintsBuilder}; /// The main command matcher. pub struct MainMatcher<'a> { matches: &'a ArgMatches<'a>, } impl<'a: 'b, 'b> MainMatcher<'a> { /// Check whether to force. pub fn force(&self) -> bool { self.matches.is_present("force") || env_var_present("FFSEND_FORCE") } /// Check whether to use no-interact mode. pub fn no_interact(&self) -> bool { self.matches.is_present("no-interact") || env_var_present("FFSEND_NO_INTERACT") } /// Check whether to assume yes. pub fn assume_yes(&self) -> bool { self.matches.is_present("yes") || env_var_present("FFSEND_YES") } /// Get the desired API version to use. pub fn api(&'a self) -> DesiredVersion { ArgApi::value(self.matches) } /// Get basic HTTP authentication credentials to use. pub fn basic_auth(&'a self) -> Option<(String, Option)> { ArgBasicAuth::value(self.matches) } /// Get the history file to use. #[cfg(feature = "history")] pub fn history(&self) -> PathBuf { // Get the path let path = self.matches.value_of("history").map(PathBuf::from); // Ensure the path is correct match path { Some(path) => path, None => quit_error_msg( "history file path not set", ErrorHintsBuilder::default() .history(true) .verbose(false) .build() .unwrap(), ), } } /// Get the timeout in seconds pub fn timeout(&self) -> u64 { self.matches .value_of("timeout") .and_then(|arg| parse_duration(arg).ok()) .expect("invalid timeout value") as u64 } /// Get the transfer timeout in seconds pub fn transfer_timeout(&self) -> u64 { self.matches .value_of("transfer-timeout") .and_then(|arg| parse_duration(arg).ok()) .expect("invalid transfer-timeout value") as u64 } /// Check whether we are incognito from the file history. #[cfg(feature = "history")] pub fn incognito(&self) -> bool { self.matches.is_present("incognito") || env_var_present("FFSEND_INCOGNITO") } /// Check whether quiet mode is used. pub fn quiet(&self) -> bool { !self.verbose() && (self.matches.is_present("quiet") || env_var_present("FFSEND_QUIET")) } /// Check whether verbose mode is used. pub fn verbose(&self) -> bool { self.matches.is_present("verbose") || env_var_present("FFSEND_VERBOSE") } } impl<'a> Matcher<'a> for MainMatcher<'a> { fn with(matches: &'a ArgMatches) -> Option { Some(MainMatcher { matches }) } } ================================================ FILE: src/cmd/matcher/mod.rs ================================================ pub mod debug; pub mod delete; pub mod download; pub mod exists; pub mod generate; #[cfg(feature = "history")] pub mod history; pub mod info; pub mod main; pub mod params; pub mod password; pub mod upload; pub mod version; // Re-export to matcher module pub use self::debug::DebugMatcher; pub use self::delete::DeleteMatcher; pub use self::download::DownloadMatcher; pub use self::exists::ExistsMatcher; pub use self::generate::GenerateMatcher; #[cfg(feature = "history")] pub use self::history::HistoryMatcher; pub use self::info::InfoMatcher; pub use self::main::MainMatcher; pub use self::params::ParamsMatcher; pub use self::password::PasswordMatcher; pub use self::upload::{CopyMode, UploadMatcher}; pub use self::version::VersionMatcher; use clap::ArgMatches; pub trait Matcher<'a>: Sized { // Construct a new matcher instance from these argument matches. fn with(matches: &'a ArgMatches) -> Option; } ================================================ FILE: src/cmd/matcher/params.rs ================================================ use clap::ArgMatches; use ffsend_api::api::Version as ApiVersion; use ffsend_api::url::Url; use super::Matcher; use crate::cmd::{ arg::{ArgDownloadLimit, ArgOwner, ArgUrl, CmdArgOption}, matcher::MainMatcher, }; /// The params command matcher. pub struct ParamsMatcher<'a> { matches: &'a ArgMatches<'a>, } impl<'a: 'b, 'b> ParamsMatcher<'a> { /// Get the file share URL. /// /// This method parses the URL into an `Url`. /// If the given URL is invalid, /// the program will quit with an error message. pub fn url(&'a self) -> Url { ArgUrl::value(self.matches) } /// Get the owner token. pub fn owner(&'a self) -> Option { // TODO: just return a string reference here? ArgOwner::value(self.matches).map(|token| token.to_owned()) } /// Get the download limit. /// /// If the download limit was the default, `None` is returned to not /// explicitly set it. pub fn download_limit( &'a self, main_matcher: &MainMatcher, api_version: ApiVersion, auth: bool, ) -> Option { ArgDownloadLimit::value_checked(self.matches, main_matcher, api_version, auth) } } impl<'a> Matcher<'a> for ParamsMatcher<'a> { fn with(matches: &'a ArgMatches) -> Option { matches .subcommand_matches("parameters") .map(|matches| ParamsMatcher { matches }) } } ================================================ FILE: src/cmd/matcher/password.rs ================================================ use clap::ArgMatches; use ffsend_api::url::Url; use rpassword::prompt_password_stderr; use crate::cmd::arg::{ArgGenPassphrase, ArgOwner, ArgPassword, ArgUrl, CmdArgFlag, CmdArgOption}; use crate::cmd::matcher::{MainMatcher, Matcher}; use crate::util::check_empty_password; /// The password command matcher. pub struct PasswordMatcher<'a> { matches: &'a ArgMatches<'a>, } impl<'a: 'b, 'b> PasswordMatcher<'a> { /// Get the file share URL. /// /// This method parses the URL into an `Url`. /// If the given URL is invalid, /// the program will quit with an error message. pub fn url(&'a self) -> Url { ArgUrl::value(self.matches) } /// Get the owner token. pub fn owner(&'a self) -> Option { // TODO: just return a string reference here? ArgOwner::value(self.matches).map(|token| token.to_owned()) } /// Get the password. /// /// The password is returned in the following format: /// `(password, generated)` pub fn password(&'a self) -> (String, bool) { // Generate a passphrase if requested if ArgGenPassphrase::is_present(self.matches) { return (ArgGenPassphrase::gen_passphrase(), true); } // Get the password, or prompt for it let password = match ArgPassword::value(self.matches) { Some(password) => password, None => { // Prompt for the password // TODO: don't unwrap/expect // TODO: create utility function for this prompt_password_stderr("New password: ") .expect("failed to read password from stdin") } }; // Create a main matcher let matcher_main = MainMatcher::with(self.matches).unwrap(); // Check for empty passwords check_empty_password(&password, &matcher_main); (password, false) } } impl<'a> Matcher<'a> for PasswordMatcher<'a> { fn with(matches: &'a ArgMatches) -> Option { matches .subcommand_matches("password") .map(|matches| PasswordMatcher { matches }) } } ================================================ FILE: src/cmd/matcher/upload.rs ================================================ use clap::ArgMatches; use ffsend_api::{api::Version as ApiVersion, config, url::Url}; use super::Matcher; use crate::cmd::{ arg::{ ArgDownloadLimit, ArgExpiryTime, ArgGenPassphrase, ArgHost, ArgPassword, CmdArgFlag, CmdArgOption, }, matcher::MainMatcher, }; use crate::util::{bin_name, env_var_present, quit_error_msg, ErrorHintsBuilder}; /// The upload command matcher. pub struct UploadMatcher<'a> { matches: &'a ArgMatches<'a>, } impl<'a: 'b, 'b> UploadMatcher<'a> { /// Get the selected file to upload. // TODO: maybe return a file or path instance here pub fn files(&'a self) -> Vec<&'a str> { self.matches .values_of("FILE") .expect("no file specified to upload") .collect() } /// The the name to use for the uploaded file. /// If no custom name is given, none is returned. // TODO: validate custom names, no path separators // TODO: only allow extension renaming with force flag pub fn name(&'a self) -> Option<&'a str> { // Get the chosen file name let name = self.matches.value_of("name")?; // The file name must not be empty // TODO: allow to force an empty name here, and process empty names on downloading if name.trim().is_empty() { quit_error_msg( "the file name must not be empty", ErrorHintsBuilder::default() .force(false) .verbose(false) .build() .unwrap(), ); } Some(name) } /// Get the host to upload to. /// /// This method parses the host into an `Url`. /// If the given host is invalid, /// the program will quit with an error message. pub fn host(&'a self) -> Url { ArgHost::value(self.matches) } /// Get the password. /// A generated passphrase will be returned if the user requested so, /// otherwise the specified password is returned. /// If no password was set, `None` is returned instead. /// /// The password is returned in the following format: /// `(password, generated)` pub fn password(&'a self) -> Option<(String, bool)> { // Generate a passphrase if requested if ArgGenPassphrase::is_present(self.matches) { return Some((ArgGenPassphrase::gen_passphrase(), true)); } // Use a specified password or use nothing ArgPassword::value(self.matches).map(|password| (password, false)) } /// Get the download limit. /// /// If the download limit was the default, `None` is returned to not /// explicitly set it. pub fn download_limit( &'a self, main_matcher: &MainMatcher, api_version: ApiVersion, auth: bool, ) -> Option { ArgDownloadLimit::value_checked(self.matches, main_matcher, api_version, auth).and_then( |d| match d { d if d == config::downloads_default(api_version, auth) => None, d => Some(d), }, ) } /// Get the expiry time in seconds. /// /// If the expiry time was not set, `None` is returned. pub fn expiry_time( &'a self, main_matcher: &MainMatcher, api_version: ApiVersion, auth: bool, ) -> Option { ArgExpiryTime::value_checked(self.matches, main_matcher, api_version, auth) } /// Check whether to archive the file to upload. #[cfg(feature = "archive")] pub fn archive(&self) -> bool { self.matches.is_present("archive") || env_var_present("FFSEND_ARCHIVE") } /// Check whether to open the file URL in the user's browser. pub fn open(&self) -> bool { self.matches.is_present("open") || env_var_present("FFSEND_OPEN") } /// Check whether to to delete local files after uploading. pub fn delete(&self) -> bool { self.matches.is_present("delete") } /// Check whether to copy the file URL in the user's clipboard, get the copy mode. #[cfg(feature = "clipboard")] pub fn copy(&self) -> Option { // Get the options let copy = self.matches.is_present("copy") || env_var_present("FFSEND_COPY"); let copy_cmd = self.matches.is_present("copy-cmd") || env_var_present("FFSEND_COPY_CMD"); // Return the corresponding copy mode if copy_cmd { Some(CopyMode::DownloadCmd) } else if copy { Some(CopyMode::Url) } else { None } } /// Check whether to shorten a share URL #[cfg(feature = "urlshorten")] pub fn shorten(&self) -> bool { self.matches.is_present("shorten") } /// Check whether to print a QR code for the share URL. #[cfg(feature = "qrcode")] pub fn qrcode(&self) -> bool { self.matches.is_present("qrcode") } } impl<'a> Matcher<'a> for UploadMatcher<'a> { fn with(matches: &'a ArgMatches) -> Option { matches .subcommand_matches("upload") .map(|matches| UploadMatcher { matches }) } } /// The copy mode. #[derive(Debug, Copy, Clone)] pub enum CopyMode { /// Copy the public share link. Url, /// Copy an ffsend download command. DownloadCmd, } impl CopyMode { /// Build the string to copy, based on the given `url` and current mode. pub fn build(&self, url: &str) -> String { match self { CopyMode::Url => url.into(), CopyMode::DownloadCmd => format!("{} download {}", bin_name(), url), } } } ================================================ FILE: src/cmd/matcher/version.rs ================================================ use ffsend_api::url::Url; use clap::ArgMatches; use super::Matcher; use crate::cmd::arg::{ArgHost, CmdArgOption}; /// The version command matcher. pub struct VersionMatcher<'a> { matches: &'a ArgMatches<'a>, } impl<'a: 'b, 'b> VersionMatcher<'a> { /// Get the host to probe. /// /// This method parses the host into an `Url`. /// If the given host is invalid, /// the program will quit with an error message. pub fn host(&'a self) -> Url { ArgHost::value(self.matches) } } impl<'a> Matcher<'a> for VersionMatcher<'a> { fn with(matches: &'a ArgMatches) -> Option { matches .subcommand_matches("version") .map(|matches| VersionMatcher { matches }) } } ================================================ FILE: src/cmd/mod.rs ================================================ pub mod arg; pub mod handler; pub mod matcher; pub mod subcmd; // Reexport modules pub use self::handler::Handler; ================================================ FILE: src/cmd/subcmd/debug.rs ================================================ use clap::{App, SubCommand}; use crate::cmd::arg::{ArgHost, CmdArg}; /// The debug command definition. pub struct CmdDebug; impl CmdDebug { pub fn build<'a, 'b>() -> App<'a, 'b> { SubCommand::with_name("debug") .about("View debug information") .visible_alias("dbg") .arg(ArgHost::build().hidden(true)) } } ================================================ FILE: src/cmd/subcmd/delete.rs ================================================ use clap::{App, SubCommand}; use crate::cmd::arg::{ArgOwner, ArgUrl, CmdArg}; /// The delete command definition. pub struct CmdDelete; impl CmdDelete { pub fn build<'a, 'b>() -> App<'a, 'b> { SubCommand::with_name("delete") .about("Delete a shared file") .visible_alias("del") .visible_alias("rm") .arg(ArgUrl::build()) .arg(ArgOwner::build()) } } ================================================ FILE: src/cmd/subcmd/download.rs ================================================ use clap::{App, Arg, SubCommand}; use crate::cmd::arg::{ArgPassword, ArgUrl, CmdArg}; /// The download command definition. pub struct CmdDownload; impl CmdDownload { pub fn build<'a, 'b>() -> App<'a, 'b> { // Build the subcommand #[allow(unused_mut)] let mut cmd = SubCommand::with_name("download") .about("Download files") .visible_alias("d") .visible_alias("down") .arg(ArgUrl::build()) .arg(ArgPassword::build()) .arg( Arg::with_name("output") .long("output") .short("o") .alias("output-file") .alias("out") .alias("file") .value_name("PATH") .help("Output file or directory"), ); // Optional archive support #[cfg(feature = "archive")] { cmd = cmd.arg( Arg::with_name("extract") .long("extract") .short("e") .alias("archive") .alias("arch") .alias("a") .help("Extract an archived file"), ) } cmd } } ================================================ FILE: src/cmd/subcmd/exists.rs ================================================ use clap::{App, SubCommand}; use crate::cmd::arg::{ArgUrl, CmdArg}; /// The exists command definition. pub struct CmdExists; impl CmdExists { pub fn build<'a, 'b>() -> App<'a, 'b> { SubCommand::with_name("exists") .about("Check whether a remote file exists") .visible_alias("e") .alias("exist") .arg(ArgUrl::build()) } } ================================================ FILE: src/cmd/subcmd/generate/completions.rs ================================================ use clap::{App, Arg, Shell, SubCommand}; /// The generate completions command definition. pub struct CmdCompletions; impl CmdCompletions { pub fn build<'a, 'b>() -> App<'a, 'b> { SubCommand::with_name("completions") .about("Shell completions") .alias("completion") .alias("complete") .arg( Arg::with_name("SHELL") .help("Shell type to generate completions for") .required(true) .multiple(true) .takes_value(true) .possible_value("all") .possible_values(&Shell::variants()) .case_insensitive(true), ) .arg( Arg::with_name("output") .long("output") .short("o") .alias("output-dir") .alias("out") .alias("dir") .value_name("DIR") .help("Shell completion files output directory"), ) } } ================================================ FILE: src/cmd/subcmd/generate/mod.rs ================================================ pub mod completions; use clap::{App, AppSettings, SubCommand}; use completions::CmdCompletions; /// The generate command definition. pub struct CmdGenerate; impl CmdGenerate { pub fn build<'a, 'b>() -> App<'a, 'b> { SubCommand::with_name("generate") .about("Generate assets") .visible_alias("gen") .setting(AppSettings::SubcommandRequiredElseHelp) .subcommand(CmdCompletions::build()) } } ================================================ FILE: src/cmd/subcmd/history.rs ================================================ use clap::{App, Arg, SubCommand}; /// The history command definition. pub struct CmdHistory; impl CmdHistory { pub fn build<'a, 'b>() -> App<'a, 'b> { SubCommand::with_name("history") .about("View file history") .visible_alias("h") .alias("ls") .arg( Arg::with_name("rm") .long("rm") .short("R") .alias("remove") .value_name("URL") .help("Remove history entry"), ) .arg( Arg::with_name("clear") .long("clear") .short("C") .alias("flush") .help("Clear all history"), ) } } ================================================ FILE: src/cmd/subcmd/info.rs ================================================ use clap::{App, SubCommand}; use crate::cmd::arg::{ArgOwner, ArgPassword, ArgUrl, CmdArg}; /// The info command definition. pub struct CmdInfo; impl CmdInfo { pub fn build<'a, 'b>() -> App<'a, 'b> { SubCommand::with_name("info") .about("Fetch info about a shared file") .visible_alias("i") .alias("information") .arg(ArgUrl::build()) .arg(ArgOwner::build()) .arg(ArgPassword::build()) } } ================================================ FILE: src/cmd/subcmd/mod.rs ================================================ pub mod debug; pub mod delete; pub mod download; pub mod exists; pub mod generate; #[cfg(feature = "history")] pub mod history; pub mod info; pub mod params; pub mod password; pub mod upload; pub mod version; // Re-export to cmd module pub use self::debug::CmdDebug; pub use self::delete::CmdDelete; pub use self::download::CmdDownload; pub use self::exists::CmdExists; pub use self::generate::CmdGenerate; #[cfg(feature = "history")] pub use self::history::CmdHistory; pub use self::info::CmdInfo; pub use self::params::CmdParams; pub use self::password::CmdPassword; pub use self::upload::CmdUpload; pub use self::version::CmdVersion; ================================================ FILE: src/cmd/subcmd/params.rs ================================================ use clap::{App, SubCommand}; use crate::cmd::arg::{ArgDownloadLimit, ArgOwner, ArgUrl, CmdArg}; /// The params command definition. pub struct CmdParams; impl CmdParams { pub fn build<'a, 'b>() -> App<'a, 'b> { // Create a list of parameter arguments, of which one is required let param_args = [ArgDownloadLimit::name()]; SubCommand::with_name("parameters") .about("Change parameters of a shared file") .visible_alias("params") .alias("param") .alias("parameter") .arg(ArgUrl::build()) .arg(ArgOwner::build()) .arg(ArgDownloadLimit::build().required_unless_one(¶m_args)) } } ================================================ FILE: src/cmd/subcmd/password.rs ================================================ use clap::{App, SubCommand}; use crate::cmd::arg::{ArgGenPassphrase, ArgOwner, ArgPassword, ArgUrl, CmdArg}; /// The password command definition. pub struct CmdPassword; impl CmdPassword { pub fn build<'a, 'b>() -> App<'a, 'b> { SubCommand::with_name("password") .about("Change the password of a shared file") .visible_alias("pass") .visible_alias("p") .arg(ArgUrl::build()) .arg(ArgPassword::build().help("Specify a password, do not prompt")) .arg(ArgGenPassphrase::build()) .arg(ArgOwner::build()) } } ================================================ FILE: src/cmd/subcmd/upload.rs ================================================ use clap::{App, Arg, SubCommand}; use crate::cmd::arg::{ ArgDownloadLimit, ArgExpiryTime, ArgGenPassphrase, ArgHost, ArgPassword, CmdArg, }; /// The upload command definition. pub struct CmdUpload; impl CmdUpload { pub fn build<'a, 'b>() -> App<'a, 'b> { // Build the subcommand #[allow(unused_mut)] let mut cmd = SubCommand::with_name("upload") .about("Upload files") .visible_alias("u") .visible_alias("up") .arg( Arg::with_name("FILE") .help("The file(s) to upload") .required(true) .multiple(true), ) .arg(ArgPassword::build().help("Protect the file with a password")) .arg(ArgGenPassphrase::build()) .arg(ArgDownloadLimit::build()) .arg(ArgExpiryTime::build()) .arg(ArgHost::build()) .arg( Arg::with_name("name") .long("name") .short("n") .alias("file") .alias("f") .value_name("NAME") .help("Rename the file being uploaded"), ) .arg( Arg::with_name("open") .long("open") .short("o") .help("Open the share link in your browser"), ) .arg( Arg::with_name("delete") .long("delete") .alias("rm") .short("D") .help("Delete local file after upload"), ); // Optional archive support #[cfg(feature = "archive")] { cmd = cmd.arg( Arg::with_name("archive") .long("archive") .short("a") .alias("arch") .help("Archive the upload in a single file"), ) } // Optional clipboard support #[cfg(feature = "clipboard")] { cmd = cmd .arg( Arg::with_name("copy") .long("copy") .short("c") .help("Copy the share link to your clipboard") .conflicts_with("copy-cmd"), ) .arg( Arg::with_name("copy-cmd") .long("copy-cmd") .alias("copy-command") .short("C") .help("Copy the ffsend download command to your clipboard") .conflicts_with("copy"), ); } // Optional url shortening support #[cfg(feature = "urlshorten")] { cmd = cmd.arg( Arg::with_name("shorten") .long("shorten") .alias("short") .alias("url-shorten") .short("S") .help("Shorten share URLs with a public service"), ) } // Optional qrcode support #[cfg(feature = "qrcode")] { cmd = cmd.arg( Arg::with_name("qrcode") .long("qrcode") .alias("qr") .short("Q") .help("Print a QR code for the share URL"), ) } cmd } } ================================================ FILE: src/cmd/subcmd/version.rs ================================================ use clap::{App, SubCommand}; use crate::cmd::arg::{ArgHost, CmdArg}; /// The version command definition. pub struct CmdVersion; impl CmdVersion { pub fn build<'a, 'b>() -> App<'a, 'b> { SubCommand::with_name("version") .about("Determine the Send server version") .alias("ver") .visible_alias("v") .arg(ArgHost::build()) } } ================================================ FILE: src/config.rs ================================================ #[cfg(feature = "infer-command")] use std::collections::HashMap; use ffsend_api::api::{DesiredVersion, Version}; /// The timeout for the Send client for generic requests, `0` to disable. pub const CLIENT_TIMEOUT: u64 = 30; /// The timeout for the Send client used to transfer (upload/download) files. /// Make sure this is big enough, or file uploads will be dropped. `0` to disable. pub const CLIENT_TRANSFER_TIMEOUT: u64 = 24 * 60 * 60; /// The default desired version to select for the server API. pub const API_VERSION_DESIRED_DEFAULT: DesiredVersion = DesiredVersion::Assume(API_VERSION_ASSUME); /// The default server API version to assume when it could not be determined. #[cfg(feature = "send3")] pub const API_VERSION_ASSUME: Version = Version::V3; #[cfg(not(feature = "send3"))] pub const API_VERSION_ASSUME: Version = Version::V2; #[cfg(feature = "infer-command")] lazy_static! { /// Hashmap holding binary names to infer subcommands for. /// /// When the `ffsend` binary is called with such a name, the corresponding subcommand is /// automatically inserted as argument. This also works when calling binaries through symbolic /// or hard links. pub static ref INFER_COMMANDS: HashMap<&'static str, &'static str> = { let mut m = HashMap::new(); m.insert("ffput", "upload"); m.insert("ffget", "download"); m.insert("ffdel", "delete"); m }; } ================================================ FILE: src/error.rs ================================================ use ffsend_api::action::delete::Error as DeleteError; use ffsend_api::action::exists::Error as ExistsError; use ffsend_api::action::params::Error as ParamsError; use ffsend_api::action::password::Error as PasswordError; use ffsend_api::action::version::Error as VersionError; use ffsend_api::file::remote_file::FileParseError; use crate::action::download::Error as CliDownloadError; use crate::action::generate::completions::Error as CliGenerateCompletionsError; #[cfg(feature = "history")] use crate::action::history::Error as CliHistoryError; use crate::action::info::Error as CliInfoError; use crate::action::upload::Error as CliUploadError; #[derive(Fail, Debug)] pub enum Error { /// An error occurred while invoking an action. #[fail(display = "")] Action(#[cause] ActionError), } impl From for Error { fn from(err: CliDownloadError) -> Error { Error::Action(ActionError::Download(err)) } } impl From for Error { fn from(err: CliInfoError) -> Error { Error::Action(ActionError::Info(err)) } } impl From for Error { fn from(err: CliUploadError) -> Error { Error::Action(ActionError::Upload(err)) } } impl From for Error { fn from(err: ActionError) -> Error { Error::Action(err) } } #[derive(Debug, Fail)] pub enum ActionError { /// An error occurred while invoking the delete action. #[fail(display = "failed to delete the file")] Delete(#[cause] DeleteError), /// An error occurred while invoking the download action. #[fail(display = "failed to download the requested file")] Download(#[cause] CliDownloadError), /// An error occurred while invoking the exists action. #[fail(display = "failed to check whether the file exists")] Exists(#[cause] ExistsError), /// An error occurred while generating completions. #[fail(display = "failed to generate shell completions")] GenerateCompletions(#[cause] CliGenerateCompletionsError), /// An error occurred while processing the file history. #[cfg(feature = "history")] #[fail(display = "failed to process the history")] History(#[cause] CliHistoryError), /// An error occurred while invoking the info action. #[fail(display = "failed to fetch file info")] Info(#[cause] CliInfoError), /// An error occurred while invoking the params action. #[fail(display = "failed to change the parameters")] Params(#[cause] ParamsError), /// An error occurred while invoking the password action. #[fail(display = "failed to change the password")] Password(#[cause] PasswordError), /// An error occurred while invoking the version action. #[fail(display = "failed to determine server version")] Version(#[cause] VersionError), /// An error occurred while invoking the upload action. #[fail(display = "failed to upload the specified file")] Upload(#[cause] CliUploadError), /// Failed to parse a share URL, it was invalid. /// This error is not related to a specific action. #[fail(display = "invalid share URL")] InvalidUrl(#[cause] FileParseError), } impl From for ActionError { fn from(err: DeleteError) -> ActionError { ActionError::Delete(err) } } impl From for ActionError { fn from(err: ExistsError) -> ActionError { ActionError::Exists(err) } } impl From for ActionError { fn from(err: CliGenerateCompletionsError) -> ActionError { ActionError::GenerateCompletions(err) } } #[cfg(feature = "history")] impl From for ActionError { fn from(err: CliHistoryError) -> ActionError { ActionError::History(err) } } impl From for ActionError { fn from(err: ParamsError) -> ActionError { ActionError::Params(err) } } impl From for ActionError { fn from(err: PasswordError) -> ActionError { ActionError::Password(err) } } impl From for ActionError { fn from(err: VersionError) -> ActionError { ActionError::Version(err) } } impl From for ActionError { fn from(err: FileParseError) -> ActionError { ActionError::InvalidUrl(err) } } ================================================ FILE: src/history.rs ================================================ use std::fs; use std::io::Error as IoError; use std::path::PathBuf; use failure::Fail; use ffsend_api::{ file::remote_file::{FileParseError, RemoteFile}, url::Url, }; use toml::{de::Error as DeError, ser::Error as SerError}; use version_compare::Cmp; use crate::util::{print_error, print_warning}; /// The minimum supported history file version. const VERSION_MIN: &str = "0.0.1"; /// The maximum supported history file version. const VERSION_MAX: &str = crate_version!(); #[derive(Serialize, Deserialize)] pub struct History { /// The application version the history file was built with. /// Used for compatibility checking. version: Option, /// The file history. files: Vec, /// Whether the list of files has changed. #[serde(skip)] changed: bool, /// An optional path to automatically save the history to. #[serde(skip)] autosave: Option, } impl History { /// Construct a new history. /// A path may be given to automatically save the history to once changed. pub fn new(autosave: Option) -> Self { let mut history = History::default(); history.autosave = autosave; history } /// Load the history from the given file. pub fn load(path: PathBuf) -> Result { // Read the file to a string let data = fs::read_to_string(&path)?; // Parse the data, set the autosave path let mut history: Self = toml::from_str(&data)?; history.autosave = Some(path); // Make sure the file version is supported if history.version.is_none() { print_warning("History file has no version, ignoring"); history.version = Some(crate_version!().into()); } else { // Get the version number from the file let version = history.version.as_ref().unwrap(); if let Ok(true) = version_compare::compare_to(version, VERSION_MIN, Cmp::Lt) { print_warning("history file version is too old, ignoring"); } else if let Ok(true) = version_compare::compare_to(version, VERSION_MAX, Cmp::Gt) { print_warning("history file has an unknown version, ignoring"); } } // Garbage collect history.gc(); Ok(history) } /// Load the history from the given file. /// If the file doesn't exist, create a new empty history instance. /// /// Autosaving will be enabled, and will save to the given file path. pub fn load_or_new(file: PathBuf) -> Result { if file.is_file() { Self::load(file) } else { Ok(Self::new(Some(file))) } } /// Save the history to the internal autosave file. pub fn save(&mut self) -> Result<(), SaveError> { // Garbage collect self.gc(); // Get the path let path = self.autosave.as_ref().ok_or(SaveError::NoPath)?; // If we have no files, remove the history file if it exists if self.files.is_empty() { if path.is_file() { fs::remove_file(&path).map_err(SaveError::Delete)?; } return Ok(()); } // Ensure the file parent directories are available if let Some(parent) = path.parent() { fs::create_dir_all(parent)?; } // Set file permissions on unix based systems #[cfg(unix)] { use std::fs::Permissions; use std::os::unix::fs::PermissionsExt; if !path.exists() { let file = fs::File::create(path).map_err(SaveError::Write)?; // Set Read/Write permissions for the user file.set_permissions(Permissions::from_mode(0o600)) .map_err(SaveError::SetPermissions)?; } } // Build the data and write to a file let data = toml::to_string(self)?; fs::write(&path, data)?; // There are no new changes, set the flag self.changed = false; Ok(()) } /// Add the given remote file to the history. /// If a file with the same ID as the given file exists, /// the files are merged, see `RemoteFile::merge()`. /// /// If `overwrite` is set to true, the given file will overwrite /// properties on the existing file. pub fn add(&mut self, file: RemoteFile, overwrite: bool) { // Merge any existing file with the same ID { // Find anything to merge let merge_info: Vec = self .files .iter_mut() .filter(|f| f.id() == file.id()) .map(|ref mut f| f.merge(&file, overwrite)) .collect(); let merged = !merge_info.is_empty(); let changed = merge_info.iter().any(|i| *i); // Return if merged, update the changed state if merged { if changed { self.changed = true; } return; } } // Add the file to the list self.files.push(file); self.changed = true; } /// Remove a file, matched by it's file ID. /// /// If any file was removed, true is returned. pub fn remove(&mut self, id: &str) -> bool { // Get the indices of files that have expired let expired_indices: Vec = self .files .iter() .enumerate() .filter(|&(_, f)| f.id() == id) .map(|(i, _)| i) .collect(); // Remove these specific files for i in expired_indices.iter().rev() { self.files.remove(*i); } // Set the changed flag, and return if expired_indices.is_empty() { self.changed = true; } !expired_indices.is_empty() } /// Remove a file by the given URL. /// /// If any file was removed, true is returned. pub fn remove_url(&mut self, url: Url) -> Result { Ok(self.remove(RemoteFile::parse_url(url, None)?.id())) } /// Get all files. pub fn files(&self) -> &Vec { &self.files } /// Get a file from the history, based on the given remote file. /// The file ID and host will be compared against all files in this history. /// If multiple files exist within the history that are equal, only one is returned. /// If no matching file was found, `None` is returned. pub fn get_file(&self, file: &RemoteFile) -> Option<&RemoteFile> { self.files .iter() .find(|f| f.id() == file.id() && f.host() == file.host()) } /// Clear all history. pub fn clear(&mut self) { self.changed = !self.files.is_empty(); self.files.clear(); } /// Garbage collect (remove) all files that have been expired, /// as defined by their `expire_at` property. /// /// If the expiry property is None (thus unknown), the file will be kept. /// /// The number of expired files is returned. pub fn gc(&mut self) -> usize { // Get a list of expired files let expired: Vec = self .files .iter() .filter(|f| f.has_expired()) .cloned() .collect(); // Remove the files for f in &expired { self.remove(f.id()); } // Set the changed flag if !expired.is_empty() { self.changed = true; } // Return the number of expired files expired.len() } } impl Drop for History { fn drop(&mut self) { // Automatically save if enabled and something was changed if self.autosave.is_some() && self.changed { // Save and report errors if let Err(err) = self.save() { print_error(err.context("failed to auto save history, ignoring")); } } } } impl Default for History { fn default() -> Self { Self { version: Some(crate_version!().into()), files: Vec::new(), changed: false, autosave: None, } } } #[derive(Debug, Fail)] pub enum Error { /// An error occurred while loading the history from a file. #[fail(display = "failed to load history from file")] Load(#[cause] LoadError), /// An error occurred while saving the history to a file. #[fail(display = "failed to save history to file")] Save(#[cause] SaveError), } impl From for Error { fn from(err: LoadError) -> Self { Error::Load(err) } } impl From for Error { fn from(err: SaveError) -> Self { Error::Save(err) } } #[derive(Debug, Fail)] pub enum LoadError { /// Failed to read the file contents from the given file. #[fail(display = "failed to read from the history file")] Read(#[cause] IoError), /// Failed to parse the loaded file. #[fail(display = "failed to parse the file contents")] Parse(#[cause] DeError), } impl From for LoadError { fn from(err: IoError) -> Self { LoadError::Read(err) } } impl From for LoadError { fn from(err: DeError) -> Self { LoadError::Parse(err) } } #[derive(Debug, Fail)] pub enum SaveError { /// No autosave file path was present, failed to save. #[fail(display = "no autosave file path specified")] NoPath, /// Failed to serialize the history for saving. #[fail(display = "failed to serialize the history for saving")] Serialize(#[cause] SerError), /// Failed to write to the history file. #[fail(display = "failed to write to the history file")] Write(#[cause] IoError), /// Failed to set file permissions to the history file. #[fail(display = "failed to set permissions to the history file")] SetPermissions(#[cause] IoError), /// Failed to delete the history file, which was tried because there /// are no history items to save. #[fail(display = "failed to delete history file, because history is empty")] Delete(#[cause] IoError), } impl From for SaveError { fn from(err: SerError) -> Self { SaveError::Serialize(err) } } impl From for SaveError { fn from(err: IoError) -> Self { SaveError::Write(err) } } ================================================ FILE: src/history_tool.rs ================================================ use failure::Fail; use ffsend_api::file::remote_file::RemoteFile; use crate::cmd::matcher::MainMatcher; use crate::history::{Error as HistoryError, History}; use crate::util::print_error; /// Load the history from the given path, add the given file, and save it /// again. /// /// When a file with the same ID already exists, the existing file is /// merged with this one. If `overwrite` is set to true, this file will /// overwrite properties in the already existing file when merging. /// /// If there is no file at the given path, new history will be created. fn add_error( matcher_main: &MainMatcher, file: RemoteFile, overwrite: bool, ) -> Result<(), HistoryError> { // Ignore if incognito if matcher_main.incognito() { return Ok(()); } // Load the history, add the file, and save let mut history = History::load_or_new(matcher_main.history())?; history.add(file, overwrite); history.save().map_err(|err| err.into()) } /// Load the history from the given path, add the given file, and save it /// again. /// If there is no file at the given path, new history will be created. /// /// When a file with the same ID already exists, the existing file is /// merged with this one. If `overwrite` is set to true, this file will /// overwrite properties in the already existing file when merging. /// /// If an error occurred, the error is printed and ignored. pub fn add(matcher_main: &MainMatcher, file: RemoteFile, overwrite: bool) { if let Err(err) = add_error(matcher_main, file, overwrite) { print_error(err.context("failed to add file to local history, ignoring")); } } /// Load the history from the given path, remove the given file by it's /// ID, and save it again. /// True is returned if any file was removed. fn remove_error(matcher_main: &MainMatcher, file: &RemoteFile) -> Result { // Ignore if incognito if matcher_main.incognito() { return Ok(false); } // Load the history, remove the file, and save let mut history = History::load_or_new(matcher_main.history())?; let removed = history.remove(file.id()); history.save()?; Ok(removed) } /// Load the history from the given path, remove the given file by it's /// ID, and save it again. /// True is returned if any file was removed. pub fn remove(matcher_main: &MainMatcher, file: &RemoteFile) -> bool { let result = remove_error(matcher_main, file); let ok = result.is_ok(); if let Err(err) = result { print_error(err.context("failed to remove file from local history, ignoring")); } ok } /// Derive the file secret and owner token from the history for the given file. /// The newly derived properties will be set into the given borrowed remote file. /// This method may be used to automatically derive the properties for some file actions /// requiring an owner token or secret, to prevent the user from having to enter it manually. /// /// If the file already has all properties set, /// nothing will be derived and `false` is returned. /// If an error occurred while deriving, /// the error is printed and `false` is returned. /// If there was no matching file in the history, /// and no properties could be derived, `false` is returned. /// Incognito mode does not have any effect on this method, /// as it won't ever change the history. /// /// If any property was successfully derived, `true` is returned. pub fn derive_file_properties(matcher_main: &MainMatcher, file: &mut RemoteFile) -> bool { // Return if all properties are already set if file.has_secret() && file.has_owner_token() { return false; } // Load the history let history = match History::load_or_new(matcher_main.history()) { Ok(history) => history, Err(err) => { print_error(err.context("failed to derive file properties from history, ignoring")); return false; } }; // Find a matching file, grab and set the owner token if available match history.get_file(file) { Some(f) => { // Set the secret if f.has_secret() { file.set_secret(f.secret_raw().clone()); } // Set the owner token if f.has_owner_token() { file.set_owner_token(f.owner_token().cloned()); } // Return whether any property was derived f.has_secret() || f.has_owner_token() } None => false, } } ================================================ FILE: src/host.rs ================================================ use ffsend_api::url::{ParseError, Url}; /// Parse the given host string, into an URL. pub fn parse_host(host: &str) -> Result { // Trim let host = host.trim(); // Make sure a valid scheme is prefixed if !host.starts_with("https://") && !host.starts_with("http://") { return Err(HostError::Scheme); } // Parse the URL, and map the errors Url::parse(host).map_err(|err| match err { ParseError::EmptyHost => HostError::Empty, ParseError::InvalidPort => HostError::Port, ParseError::InvalidIpv4Address => HostError::Ipv4, ParseError::InvalidIpv6Address => HostError::Ipv6, ParseError::InvalidDomainCharacter => HostError::DomainCharacter, ParseError::RelativeUrlWithoutBase => HostError::NoBase, err => HostError::Other(err), }) } /// An error that has occurred while parsing a host. #[derive(Debug, Fail)] pub enum HostError { /// The URL scheme is missing or invalid. #[fail(display = "the URL must have the 'https://' or 'http://' scheme")] Scheme, /// The host address is empty. #[fail(display = "empty host address")] Empty, /// The port number is invalid. #[fail(display = "invalid port")] Port, /// The given IPv4 styled address is invalid. #[fail(display = "invalid IPv4 address in the host")] Ipv4, /// The given IPv6 styled address is invalid. #[fail(display = "invalid IPv6 address in the host")] Ipv6, /// The domain contains an invalid character. #[fail(display = "invalid character in the domain")] DomainCharacter, /// The base host is missing from the host URL. #[fail(display = "missing host in the host URL")] NoBase, /// Failed to parse the host URL due to another reason. #[fail(display = "could not parse host URL")] Other(#[cause] ParseError), } ================================================ FILE: src/main.rs ================================================ #[macro_use] extern crate clap; #[macro_use] extern crate derive_builder; #[macro_use] extern crate failure; #[macro_use] extern crate lazy_static; #[cfg(feature = "history")] #[macro_use] extern crate serde_derive; mod action; #[cfg(feature = "archive")] mod archive; mod client; mod cmd; mod config; mod error; #[cfg(feature = "history")] mod history; #[cfg(feature = "history")] mod history_tool; mod host; mod progress; #[cfg(feature = "urlshorten")] mod urlshorten; mod util; use std::process; use crate::action::debug::Debug; use crate::action::delete::Delete; use crate::action::download::Download; use crate::action::exists::Exists; use crate::action::generate::Generate; #[cfg(feature = "history")] use crate::action::history::History; use crate::action::info::Info; use crate::action::params::Params; use crate::action::password::Password; use crate::action::upload::Upload; use crate::action::version::Version; use crate::cmd::{ matcher::{MainMatcher, Matcher}, Handler, }; use crate::error::Error; use crate::util::{bin_name, highlight, quit_error, ErrorHints}; /// Application entrypoint. fn main() { // Probe for OpenSSL certificates openssl_probe::init_ssl_cert_env_vars(); // Parse CLI arguments let cmd_handler = Handler::parse(); // Invoke the proper action if let Err(err) = invoke_action(&cmd_handler) { quit_error(err, ErrorHints::default()); }; } /// Invoke the proper action based on the CLI input. /// /// If no proper action is selected, the program will quit with an error /// message. fn invoke_action(handler: &Handler) -> Result<(), Error> { // Match the debug command if handler.debug().is_some() { return Debug::new(handler.matches()) .invoke() .map_err(|err| err.into()); } // Match the delete command if handler.delete().is_some() { return Delete::new(handler.matches()) .invoke() .map_err(|err| err.into()); } // Match the download command if handler.download().is_some() { return Download::new(handler.matches()) .invoke() .map_err(|err| err.into()); } // Match the exists command if handler.exists().is_some() { return Exists::new(handler.matches()) .invoke() .map_err(|err| err.into()); } // Match the generate command if handler.generate().is_some() { return Generate::new(handler.matches()) .invoke() .map_err(|err| err.into()); } // Match the history command #[cfg(feature = "history")] { if handler.history().is_some() { return History::new(handler.matches()) .invoke() .map_err(|err| err.into()); } } // Match the info command if handler.info().is_some() { return Info::new(handler.matches()) .invoke() .map_err(|err| err.into()); } // Match the parameters command if handler.params().is_some() { return Params::new(handler.matches()) .invoke() .map_err(|err| err.into()); } // Match the password command if handler.password().is_some() { return Password::new(handler.matches()) .invoke() .map_err(|err| err.into()); } // Match the upload command if handler.upload().is_some() { return Upload::new(handler.matches()) .invoke() .map_err(|err| err.into()); } // Match the version command if handler.version().is_some() { return Version::new(handler.matches()) .invoke() .map_err(|err| err.into()); } // Get the main matcher let matcher_main = MainMatcher::with(handler.matches()).unwrap(); // Print the main info and return if !matcher_main.quiet() { print_main_info(); } Ok(()) } /// Print the main info, shown when no subcommands were supplied. pub fn print_main_info() -> ! { // Get the name of the used executable let bin = bin_name(); // Print the main info println!("{} {}", crate_name!(), crate_version!()); println!("Usage: {} [FLAGS] ...", bin); println!(); println!(crate_description!()); println!(); println!("Missing subcommand. Here are the most used:"); println!(" {}", highlight(&format!("{} upload ...", bin))); println!(" {}", highlight(&format!("{} download ...", bin))); println!(); println!("To show all subcommands, features and other help:"); println!(" {}", highlight(&format!("{} help [SUBCOMMAND]", bin))); println!(); println!("The default public Send host is provided by Tim Visee."); println!("Please consider to donate and help keep it running: https://vis.ee/donate"); process::exit(1) } ================================================ FILE: src/progress.rs ================================================ use std::io::{stderr, Stderr}; use std::time::Duration; use ffsend_api::pipe::ProgressReporter; use pbr::{ProgressBar as Pbr, Units}; /// The refresh rate of the progress bar, in milliseconds. const PROGRESS_BAR_FPS_MILLIS: u64 = 200; /// A progress bar reporter. pub struct ProgressBar<'a> { progress_bar: Option>, msg_progress: &'a str, msg_finish: &'a str, } impl<'a> ProgressBar<'a> { /// Construct a new progress bar, with the given messages. pub fn new(msg_progress: &'a str, msg_finish: &'a str) -> ProgressBar<'a> { Self { progress_bar: None, msg_progress, msg_finish, } } /// Construct a new progress bar for uploading. pub fn new_upload() -> ProgressBar<'a> { Self::new("Encrypt & Upload ", "Upload complete") } /// Construct a new progress bar for downloading. pub fn new_download() -> ProgressBar<'a> { Self::new("Download & Decrypt ", "Download complete") } } impl<'a> ProgressReporter for ProgressBar<'a> { /// Start the progress with the given total. fn start(&mut self, total: u64) { // Initialize the progress bar let mut progress_bar = Pbr::on(stderr(), total); progress_bar.set_max_refresh_rate(Some(Duration::from_millis(PROGRESS_BAR_FPS_MILLIS))); progress_bar.set_units(Units::Bytes); progress_bar.message(self.msg_progress); self.progress_bar = Some(progress_bar); } /// A progress update. fn progress(&mut self, progress: u64) { self.progress_bar .as_mut() .expect("progress bar not yet instantiated, cannot set progress") .set(progress); } /// Finish the progress. fn finish(&mut self) { let progress_bar = self .progress_bar .as_mut() .expect("progress bar not yet instantiated"); #[cfg(not(target_os = "windows"))] progress_bar.finish_print(self.msg_finish); #[cfg(target_os = "windows")] { progress_bar.finish_println(self.msg_finish); eprintln!(); } } } ================================================ FILE: src/urlshorten.rs ================================================ //! URL shortening mechanics. use ffsend_api::{ api::request::{ensure_success, ResponseError}, client::Client, reqwest, url::{self, Url}, }; use urlshortener::{ providers::{self, Provider}, request::{Method, Request}, }; /// An URL shortening result. type Result = ::std::result::Result; /// Shorten the given URL. pub fn shorten(client: &Client, url: &str) -> Result { // TODO: allow selecting other shorteners request(client, providers::request(url, &Provider::IsGd)) } /// Shorten the given URL. pub fn shorten_url(client: &Client, url: &Url) -> Result { Url::parse(&shorten(client, url.as_str())?).map_err(|err| err.into()) } /// Do the request as given, return the response. fn request(client: &Client, req: Request) -> Result { // Start the request builder let mut builder = match req.method { Method::Get => client.get(&req.url), Method::Post => client.post(&req.url), }; // Define the custom user agent if let Some(_agent) = req.user_agent.clone() { // TODO: implement this // builder.header(header::UserAgent::new(agent.0)); panic!("Custom UserAgent for URL shortener not yet implemented"); } // Define the custom content type if let Some(_content_type) = req.content_type { // TODO: implement this // match content_type { // ContentType::Json => builder.header(header::ContentType::json()), // ContentType::FormUrlEncoded => { // builder.header(header::ContentType::form_url_encoded()) // } // }; panic!("Custom UserAgent for URL shortener not yet implemented"); } // Define the custom body if let Some(body) = req.body.clone() { builder = builder.body(body); } // Send the request, ensure success let response = builder.send().map_err(Error::Request)?; ensure_success(&response)?; // Respond with the body text response.text().map_err(Error::Malformed) } /// An URL shortening error. #[derive(Debug, Fail)] pub enum Error { /// Failed to send the shortening request. #[fail(display = "failed to send URL shorten request")] Request(#[cause] reqwest::Error), /// The server responded with a bad response. #[fail(display = "failed to shorten URL, got bad response")] Response(#[cause] ResponseError), /// The server responded with a malformed response. #[fail(display = "failed to shorten URL, got malformed response")] Malformed(#[cause] reqwest::Error), /// An error occurred while parsing the shortened URL. #[fail(display = "failed to shorten URL, could not parse URL")] Url(#[cause] url::ParseError), } impl From for Error { fn from(err: url::ParseError) -> Self { Error::Url(err) } } impl From for Error { fn from(err: ResponseError) -> Self { Error::Response(err) } } ================================================ FILE: src/util.rs ================================================ #[cfg(feature = "clipboard-crate")] extern crate clip; #[cfg(feature = "clipboard-bin")] extern crate which; use std::borrow::Borrow; use std::env::{self, current_exe, var_os}; use std::ffi::OsStr; #[cfg(feature = "clipboard")] use std::fmt; use std::fmt::{Debug, Display}; #[cfg(feature = "clipboard-bin")] use std::io::ErrorKind as IoErrorKind; use std::io::{self, Read}; use std::io::{stderr, stdin, Error as IoError, Write}; use std::iter; use std::path::Path; use std::path::PathBuf; use std::process::exit; #[cfg(feature = "clipboard-bin")] use std::process::{Command, Stdio}; #[cfg(feature = "clipboard-crate")] use self::clip::{ClipboardContext, ClipboardProvider}; use chrono::Duration; use colored::*; #[cfg(feature = "history")] use directories::ProjectDirs; use failure::{err_msg, Fail}; #[cfg(feature = "clipboard-crate")] use failure::{Compat, Error}; use ffsend_api::{ api::request::{ensure_success, ResponseError}, client::Client, reqwest, url::Url, }; use fs2::available_space; use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; use regex::Regex; use rpassword::prompt_password_stderr; #[cfg(feature = "clipboard-bin")] use which::which; use crate::cmd::matcher::MainMatcher; /// Print a success message. pub fn print_success(msg: &str) { eprintln!("{}", msg.green()); } /// Print the given error in a proper format for the user, /// with it's causes. pub fn print_error(err: impl Borrow) { // Report each printable error, count them let count = err .borrow() .causes() .map(|err| format!("{}", err)) .filter(|err| !err.is_empty()) .enumerate() .map(|(i, err)| { if i == 0 { eprintln!("{} {}", highlight_error("error:"), err); } else { eprintln!("{} {}", highlight_error("caused by:"), err); } }) .count(); // Fall back to a basic message if count == 0 { eprintln!( "{} {}", highlight_error("error:"), "an undefined error occurred" ); } } /// Print the given error message in a proper format for the user, /// with it's causes. pub fn print_error_msg(err: S) where S: AsRef + Display + Debug + Sync + Send + 'static, { print_error(err_msg(err).compat()); } /// Print a warning. pub fn print_warning(err: S) where S: AsRef + Display + Debug + Sync + Send + 'static, { eprintln!("{} {}", highlight_warning("warning:"), err); } /// Quit the application regularly. pub fn quit() -> ! { exit(0); } /// Quit the application with an error code, /// and print the given error. pub fn quit_error(err: E, hints: impl Borrow) -> ! { // Print the error print_error(err); // Print error hints hints.borrow().print(); // Quit exit(1); } /// Quit the application with an error code, /// and print the given error message. pub fn quit_error_msg(err: S, hints: impl Borrow) -> ! where S: AsRef + Display + Debug + Sync + Send + 'static, { quit_error(err_msg(err).compat(), hints); } /// The error hint configuration. #[derive(Clone, Builder)] #[builder(default)] pub struct ErrorHints { /// Show about specifying an API version. api: bool, /// A list of info messages to print along with the error. info: Vec, /// Show about the name option. name: bool, /// Show about the password option. password: bool, /// Show about the owner option. owner: bool, /// Show about the history flag. #[cfg(feature = "history")] history: bool, /// Show about the force flag. force: bool, /// Show about the verbose flag. verbose: bool, /// Show about the help flag. help: bool, } impl ErrorHints { /// Check whether any hint should be printed. pub fn any(&self) -> bool { // Determine the result #[allow(unused_mut)] let mut result = self.name || self.password || self.owner || self.force || self.verbose || self.help; // Factor in the history hint when enabled #[cfg(feature = "history")] { result = result || self.history; } result } /// Print the error hints. pub fn print(&self) { // Print info messages for msg in &self.info { eprintln!("{} {}", highlight_info("info:"), msg); } // Stop if nothing should be printed if !self.any() { return; } eprint!("\n"); // Print hints if self.api { eprintln!( "Use '{}' to select a server API version", highlight("--api ") ); } if self.name { eprintln!( "Use '{}' to specify a file name", highlight("--name ") ); } if self.password { eprintln!( "Use '{}' to specify a password", highlight("--password ") ); } if self.owner { eprintln!( "Use '{}' to specify an owner token", highlight("--owner ") ); } #[cfg(feature = "history")] { if self.history { eprintln!( "Use '{}' to specify a history file", highlight("--history ") ); } } if self.force { eprintln!("Use '{}' to force", highlight("--force")); } if self.verbose { eprintln!("For detailed errors try '{}'", highlight("--verbose")); } if self.help { eprintln!("For more information try '{}'", highlight("--help")); } // Flush let _ = stderr().flush(); } } impl Default for ErrorHints { fn default() -> Self { ErrorHints { api: false, info: Vec::new(), name: false, password: false, owner: false, #[cfg(feature = "history")] history: false, force: false, verbose: true, help: true, } } } impl ErrorHintsBuilder { /// Add a single info entry. pub fn add_info(mut self, info: String) -> Self { // Initialize the info list if self.info.is_none() { self.info = Some(Vec::new()); } // Add the item to the info list if let Some(ref mut list) = self.info { list.push(info); } self } } /// Highlight the given text with a color. pub fn highlight(msg: &str) -> ColoredString { msg.yellow() } /// Highlight the given text with an error color. pub fn highlight_error(msg: &str) -> ColoredString { msg.red().bold() } /// Highlight the given text with an warning color. pub fn highlight_warning(msg: &str) -> ColoredString { highlight(msg).bold() } /// Highlight the given text with an info color pub fn highlight_info(msg: &str) -> ColoredString { msg.cyan() } /// Open the given URL in the users default browser. /// The browsers exit status is returned. pub fn open_url(url: impl Borrow) -> Result<(), IoError> { open_path(url.borrow().as_str()) } /// Open the given path or URL using the program configured on the system. /// The program exit status is returned. pub fn open_path(path: &str) -> Result<(), IoError> { open::that(path) } /// Set the clipboard of the user to the given `content` string. #[cfg(feature = "clipboard")] pub fn set_clipboard(content: String) -> Result<(), ClipboardError> { ClipboardType::select().set(content) } /// Clipboard management enum. /// /// Defines which method of setting the clipboard is used. /// Invoke `ClipboardType::select()` to select the best variant to use determined at runtime. /// /// Usually, the `Native` variant is used. However, on Linux system a different variant will be /// selected which will call a system binary to set the clipboard. This must be done because the /// native clipboard interface only has a lifetime of the application. This means that the /// clipboard is instantly cleared as soon as this application quits, which is always immediately. /// This limitation is due to security reasons as defined by X11. The alternative binaries we set /// the clipboard with spawn a daemon in the background to keep the clipboard alive until it's /// flushed. #[cfg(feature = "clipboard")] #[derive(Clone, Eq, PartialEq)] pub enum ClipboardType { /// Native operating system clipboard. #[cfg(feature = "clipboard-crate")] Native, /// Manage clipboard through `xclip` on Linux. /// /// May contain a binary path if specified at compile time through the `XCLIP_PATH` variable. #[cfg(feature = "clipboard-bin")] Xclip(Option), /// Manage clipboard through `xsel` on Linux. /// /// May contain a binary path if specified at compile time through the `XSEL_PATH` variable. #[cfg(feature = "clipboard-bin")] Xsel(Option), } #[cfg(feature = "clipboard")] impl ClipboardType { /// Select the clipboard type to use, depending on the runtime system. pub fn select() -> Self { #[cfg(feature = "clipboard-crate")] { ClipboardType::Native } #[cfg(feature = "clipboard-bin")] { if let Some(path) = option_env!("XCLIP_PATH") { ClipboardType::Xclip(Some(path.to_owned())) } else if let Some(path) = option_env!("XSEL_PATH") { ClipboardType::Xsel(Some(path.to_owned())) } else if which("xclip").is_ok() { ClipboardType::Xclip(None) } else if which("xsel").is_ok() { ClipboardType::Xsel(None) } else { // TODO: should we error here instead, as no clipboard binary was found? ClipboardType::Xclip(None) } } } /// Set clipboard contents through the selected clipboard type. pub fn set(&self, content: String) -> Result<(), ClipboardError> { match self { #[cfg(feature = "clipboard-crate")] ClipboardType::Native => Self::native_set(content), #[cfg(feature = "clipboard-bin")] ClipboardType::Xclip(path) => Self::xclip_set(path.clone(), &content), #[cfg(feature = "clipboard-bin")] ClipboardType::Xsel(path) => Self::xsel_set(path.clone(), &content), } } /// Set the clipboard through a native interface. /// /// This is used on non-Linux systems. #[cfg(feature = "clipboard-crate")] fn native_set(content: String) -> Result<(), ClipboardError> { ClipboardProvider::new() .and_then(|mut context: ClipboardContext| context.set_contents(content)) .map_err(|err| format_err!("{}", err).compat()) .map_err(ClipboardError::Native) } #[cfg(feature = "clipboard-bin")] fn xclip_set(path: Option, content: &str) -> Result<(), ClipboardError> { Self::sys_cmd_set( "xclip", Command::new(path.unwrap_or_else(|| "xclip".into())) .arg("-sel") .arg("clip"), content, ) } #[cfg(feature = "clipboard-bin")] fn xsel_set(path: Option, content: &str) -> Result<(), ClipboardError> { Self::sys_cmd_set( "xsel", Command::new(path.unwrap_or_else(|| "xsel".into())).arg("--clipboard"), content, ) } #[cfg(feature = "clipboard-bin")] fn sys_cmd_set( bin: &'static str, command: &mut Command, content: &str, ) -> Result<(), ClipboardError> { // Spawn the command process for setting the clipboard let mut process = match command.stdin(Stdio::piped()).stdout(Stdio::null()).spawn() { Ok(process) => process, Err(err) => { return Err(match err.kind() { IoErrorKind::NotFound => ClipboardError::NoBinary, _ => ClipboardError::BinaryIo(bin, err), }); } }; // Write the contents to the xclip process process .stdin .as_mut() .unwrap() .write_all(content.as_bytes()) .map_err(|err| ClipboardError::BinaryIo(bin, err))?; // Wait for xclip to exit let status = process .wait() .map_err(|err| ClipboardError::BinaryIo(bin, err))?; if !status.success() { return Err(ClipboardError::BinaryStatus( bin, status.code().unwrap_or(0), )); } Ok(()) } } #[cfg(feature = "clipboard")] impl fmt::Display for ClipboardType { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { #[cfg(feature = "clipboard-crate")] ClipboardType::Native => write!(f, "native"), #[cfg(feature = "clipboard-bin")] ClipboardType::Xclip(path) => match path { None => write!(f, "xclip"), Some(path) => write!(f, "xclip ({})", path), }, #[cfg(feature = "clipboard-bin")] ClipboardType::Xsel(path) => match path { None => write!(f, "xsel"), Some(path) => write!(f, "xsel ({})", path), }, } } } #[cfg(feature = "clipboard")] #[derive(Debug, Fail)] pub enum ClipboardError { /// A generic error occurred while setting the clipboard contents. /// /// This is for non-Linux systems, using a native clipboard interface. #[cfg(feature = "clipboard-crate")] #[fail(display = "failed to access clipboard")] Native(#[cause] Compat), /// The `xclip` or `xsel` binary could not be found on the system, required for clipboard support. #[cfg(feature = "clipboard-bin")] #[fail(display = "failed to access clipboard, xclip or xsel is not installed")] NoBinary, /// An error occurred while using `xclip` or `xsel` to set the clipboard contents. /// This problem probably occurred when starting, or while piping the clipboard contents to /// the process. #[cfg(feature = "clipboard-bin")] #[fail(display = "failed to access clipboard using {}", _0)] BinaryIo(&'static str, #[cause] IoError), /// `xclip` or `xsel` unexpectedly exited with a non-successful status code. #[cfg(feature = "clipboard-bin")] #[fail( display = "failed to use clipboard, {} exited with status code {}", _0, _1 )] BinaryStatus(&'static str, i32), } /// Check for an empty password in the given `password`. /// If the password is empty the program will quit with an error unless /// forced. // TODO: move this to a better module pub fn check_empty_password(password: &str, matcher_main: &MainMatcher) { if !matcher_main.force() && password.is_empty() { quit_error_msg( "an empty password is not supported by the web interface", ErrorHintsBuilder::default() .force(true) .verbose(false) .build() .unwrap(), ) } } /// Prompt the user to enter a password. /// /// If `empty` is `false`, empty passwords aren't allowed unless forced. pub fn prompt_password(main_matcher: &MainMatcher, optional: bool) -> Option { // Quit with an error if we may not interact if !optional && main_matcher.no_interact() { quit_error_msg( "missing password, must be specified in no-interact mode", ErrorHintsBuilder::default() .password(true) .verbose(false) .build() .unwrap(), ); } // Prompt for the password let prompt = if optional { "Password (optional): " } else { "Password: " }; match prompt_password_stderr(prompt) { // If optional and nothing is entered, regard it as not defined Ok(password) => { if password.is_empty() && optional { None } else { Some(password) } } // On input error, propagate the error or don't use a password if optional Err(err) => { if !optional { quit_error( err.context("failed to read password from password prompt"), ErrorHints::default(), ) } else { None } } } } /// Get a password if required. /// This method will ensure a password is set (or not) in the given `password` /// parameter, as defined by `needs`. /// If a password is needed, it may optionally be entered if `option` is set to true. /// /// This method will prompt the user for a password, if one is required but /// wasn't set. An ignore message will be shown if it was not required while it /// was set. /// /// Returns true if a password is now set, false if not. pub fn ensure_password( password: &mut Option, needs: bool, main_matcher: &MainMatcher, optional: bool, ) -> bool { // Return if we're fine, ignore if set but we don't need it if password.is_some() == needs { return needs; } if !needs { // Notify the user a set password is ignored if password.is_some() { println!("Ignoring password, it is not required"); *password = None; } return false; } // Check whether we allow interaction let interact = !main_matcher.no_interact(); loop { // Prompt for an owner token if not set yet if password.is_none() { // Do not ask for a token if optional when non-interactive or forced if optional && (!interact || main_matcher.force()) { return false; } // Ask for the password *password = prompt_password(main_matcher, optional); } // The token must not be empty, unless it's optional let empty = password.is_none(); if empty && !optional { eprintln!( "No password given, which is required. Use {} to cancel.", highlight("[CTRL+C]"), ); } else { return !empty; } } } /// Prompt the user to enter some value. /// The prompt that is shown should be passed to `msg`, /// excluding the `:` suffix. pub fn prompt(msg: &str, main_matcher: &MainMatcher) -> String { // Quit with an error if we may not interact if main_matcher.no_interact() { quit_error_msg( format!( "could not prompt for '{}' in no-interact mode, maybe specify it", msg, ), ErrorHints::default(), ); } // Show the prompt eprint!("{}: ", msg); let _ = stderr().flush(); // Get the input let mut input = String::new(); if let Err(err) = stdin().read_line(&mut input) { quit_error( err.context("failed to read input from prompt"), ErrorHints::default(), ); } // Trim and return input.trim().to_owned() } /// Prompt the user for a question, allowing a yes or now answer. /// True is returned if yes was answered, false if no. /// /// A default may be given, which is chosen if no-interact mode is /// enabled, or if enter was pressed by the user without entering anything. pub fn prompt_yes(msg: &str, def: Option, main_matcher: &MainMatcher) -> bool { // Define the available options string let options = format!( "[{}/{}]", match def { Some(def) if def => "Y", _ => "y", }, match def { Some(def) if !def => "N", _ => "n", } ); // Assume yes if main_matcher.assume_yes() { eprintln!("{} {}: yes", msg, options); return true; } // Autoselect if in no-interact mode if main_matcher.no_interact() { if let Some(def) = def { eprintln!("{} {}: {}", msg, options, if def { "yes" } else { "no" }); return def; } else { quit_error_msg( format!( "could not prompt question '{}' in no-interact mode, maybe specify it", msg, ), ErrorHints::default(), ); } } // Get the user input let answer = prompt(&format!("{} {}", msg, options), main_matcher); // Assume the default if the answer is empty if answer.is_empty() && def.is_some() { return def.unwrap(); } // Derive a boolean and return match derive_bool(&answer) { Some(answer) => answer, None => prompt_yes(msg, def, main_matcher), } } /// Try to derive true or false (yes or no) from the given input. /// None is returned if no boolean could be derived accurately. fn derive_bool(input: &str) -> Option { // Process the input let input = input.trim().to_lowercase(); // Handle short or incomplete answers match input.as_str() { "y" | "ye" | "t" | "1" => return Some(true), "n" | "f" | "0" => return Some(false), _ => {} } // Handle complete answers with any suffix if input.starts_with("yes") || input.starts_with("true") { return Some(true); } if input.starts_with("no") || input.starts_with("false") { return Some(false); } // The answer could not be determined, return none None } /// Prompt the user to enter an owner token. pub fn prompt_owner_token(main_matcher: &MainMatcher, optional: bool) -> String { prompt( if optional { "Owner token (optional)" } else { "Owner token" }, main_matcher, ) } /// Get the owner token. /// This method will ensure an owner token is set in the given `token` /// parameter. /// /// This method will prompt the user for the token, if it wasn't set. /// /// Returns if an owner token was set. /// If `optional` is false, this always returns true. /// /// If in non-interactive or force mode, the user will not be prompted for a token if `optional` is /// set to true. pub fn ensure_owner_token( token: &mut Option, main_matcher: &MainMatcher, optional: bool, ) -> bool { // Check whether we allow interaction let interact = !main_matcher.no_interact(); // Notify that an owner token is required if interact && token.is_none() { if optional { println!("The file owner token is recommended for authentication."); } else { println!("The file owner token is required for authentication."); } } loop { // Prompt for an owner token if not set yet if token.is_none() { // Do not ask for a token if optional when non-interactive or forced if optional && (!interact || main_matcher.force()) { return false; } // Ask for the token, or quit with an error if non-interactive if interact { *token = Some(prompt_owner_token(main_matcher, optional)); } else { quit_error_msg( "missing owner token, must be specified in no-interact mode", ErrorHintsBuilder::default() .owner(true) .verbose(false) .build() .unwrap(), ); } } // The token must not be empty, unless it's optional let empty = token.as_ref().unwrap().is_empty(); if empty { *token = None; } if empty && !optional { eprintln!( "Empty owner token given, which is invalid. Use {} to cancel.", highlight("[CTRL+C]"), ); } else { return !empty; } } } /// Format the given number of bytes readable for humans. pub fn format_bytes(bytes: u64) -> String { let bytes = bytes as f64; let kb = 1024f64; match bytes { bytes if bytes >= kb.powf(4_f64) => format!("{:.*} TiB", 2, bytes / kb.powf(4_f64)), bytes if bytes >= kb.powf(3_f64) => format!("{:.*} GiB", 2, bytes / kb.powf(3_f64)), bytes if bytes >= kb.powf(2_f64) => format!("{:.*} MiB", 2, bytes / kb.powf(2_f64)), bytes if bytes >= kb => format!("{:.*} KiB", 2, bytes / kb), _ => format!("{:.*} B", 0, bytes), } } /// Parse the given duration string from human readable format into seconds. /// This method parses a string of time components to represent the given duration. /// /// The following time units are used: /// - `w`: weeks /// - `d`: days /// - `h`: hours /// - `m`: minutes /// - `s`: seconds /// The following time strings can be parsed: /// - `8w6d` /// - `23h14m` /// - `9m55s` /// - `1s1s1s1s1s` pub fn parse_duration(duration: &str) -> Result { // Build a regex to grab time parts let re = Regex::new(r"(?i)([0-9]+)(([a-z]|\s*$))") .expect("failed to compile duration parsing regex"); // We must find any match if re.find(duration).is_none() { return Err(ParseDurationError::Empty); } // Parse each time part, sum it's seconds let mut seconds = 0; for capture in re.captures_iter(duration) { // Parse time value and modifier let number = capture[1] .parse::() .map_err(ParseDurationError::InvalidValue)?; let modifier = capture[2].trim().to_lowercase(); // Multiply and sum seconds by modifier seconds += match modifier.as_str() { "" | "s" => number, "m" => number * 60, "h" => number * 60 * 60, "d" => number * 60 * 60 * 24, "w" => number * 60 * 60 * 24 * 7, m => return Err(ParseDurationError::UnknownIdentifier(m.into())), }; } Ok(seconds) } /// Represents a duration parsing error. #[derive(Debug, Fail)] pub enum ParseDurationError { /// The given duration string did not contain any duration part. #[fail(display = "given string did not contain any duration part")] Empty, /// A numeric value was invalid. #[fail(display = "duration part has invalid numeric value")] InvalidValue(std::num::ParseIntError), /// The given duration string contained an invalid duration modifier. #[fail(display = "duration part has unknown time identifier '{}'", _0)] UnknownIdentifier(String), } /// Format the given duration in a human readable format. /// This method builds a string of time components to represent /// the given duration. /// /// The following time units are used: /// - `w`: weeks /// - `d`: days /// - `h`: hours /// - `m`: minutes /// - `s`: seconds /// /// Only the two most significant units are returned. /// If the duration is zero seconds or less `now` is returned. /// /// The following time strings may be produced: /// - `8w6d` /// - `23h14m` /// - `9m55s` /// - `1s` /// - `now` pub fn format_duration(duration: impl Borrow) -> String { // Get the total number of seconds, return immediately if zero or less let mut secs = duration.borrow().num_seconds(); if secs <= 0 { return "now".into(); } // Build a list of time units, define a list for time components let mut components = Vec::new(); let units = [ (60 * 60 * 24 * 7, "w"), (60 * 60 * 24, "d"), (60 * 60, "h"), (60, "m"), (1, "s"), ]; // Fill the list of time components based on the units which fit for unit in &units { if secs >= unit.0 { components.push(format!("{}{}", secs / unit.0, unit.1)); secs %= unit.0; } } // Show only the two most significant components and join them in a string components.truncate(2); components.join("") } /// Format the given boolean, as `yes` or `no`. pub fn format_bool(b: bool) -> &'static str { if b { "yes" } else { "no" } } /// Get the name of the executable that was invoked. /// /// When a symbolic or hard link is used, the name of the link is returned. /// /// This attempts to obtain the binary name in the following order: /// - name in first item of program arguments via `std::env::args` /// - current executable name via `std::env::current_exe` /// - crate name pub fn bin_name() -> String { env::args_os() .next() .filter(|path| !path.is_empty()) .map(PathBuf::from) .or_else(|| current_exe().ok()) .and_then(|p| p.file_name().map(|n| n.to_owned())) .and_then(|n| n.into_string().ok()) .unwrap_or_else(|| crate_name!().into()) } /// Ensure that there is enough free disk space available at the given `path`, /// to store a file with the given `size`. /// /// If an error occurred while querying the file system, /// the error is reported to the user and the method returns. /// /// If there is not enough disk space available, /// an error is reported and the program will quit. pub fn ensure_enough_space>(path: P, size: u64) { // Get the available space at this path let space = match available_space(path) { Ok(space) => space, Err(err) => { print_error(err.context("failed to check available space on disk, ignoring")); return; } }; // Return if enough disk space is available if space >= size { return; } // Create an info message giving details about the required space let info = format!( "{} of space required, but only {} is available", format_bytes(size), format_bytes(space), ); // Print an descriptive error and quit quit_error( err_msg("not enough disk space available in the target directory") .context("failed to download file"), ErrorHintsBuilder::default() .add_info(info) .force(true) .verbose(false) .build() .unwrap(), ); } /// Get the project directories instance for this application. /// This may be used to determine the project, cache, configuration, data and /// some other directory paths. #[cfg(feature = "history")] pub fn app_project_dirs() -> ProjectDirs { ProjectDirs::from("", "", crate_name!()) .expect("failed to determine location of project directories") } /// Get the default path to use for the history file. #[cfg(feature = "history")] pub fn app_history_file_path() -> PathBuf { app_project_dirs().cache_dir().join("history.toml") } /// Get the default path to use for the history file, as a string. #[cfg(feature = "history")] pub fn app_history_file_path_string() -> String { app_history_file_path().to_str().unwrap().to_owned() } /// Check whether an environment variable with the given key is present in the context of the /// current process. The environment variable doesn't have to hold any specific value. /// Returns `true` if present, `false` if not. pub fn env_var_present(key: impl AsRef) -> bool { var_os(key).is_some() } /// Get a list of all features that were enabled during compilation. pub fn features_list() -> Vec<&'static str> { // Build the list #[allow(unused_mut)] let mut features = Vec::new(); // Add each feature #[cfg(feature = "archive")] features.push("archive"); #[cfg(feature = "clipboard")] features.push("clipboard"); #[cfg(feature = "clipboard-bin")] features.push("clipboard-bin"); #[cfg(feature = "clipboard-crate")] features.push("clipboard-crate"); #[cfg(feature = "history")] features.push("history"); #[cfg(feature = "qrcode")] features.push("qrcode"); #[cfg(feature = "urlshorten")] features.push("urlshorten"); #[cfg(feature = "infer-command")] features.push("infer-command"); #[cfg(feature = "no-qcolor")] features.push("no-color"); #[cfg(feature = "send2")] features.push("send2"); #[cfg(feature = "send3")] features.push("send3"); #[cfg(feature = "crypto-ring")] features.push("crypto-ring"); #[cfg(feature = "crypto-openssl")] features.push("crypto-openssl"); features } /// Get a list of supported API versions. pub fn api_version_list() -> Vec<&'static str> { // Build the list #[allow(unused_mut)] let mut versions = Vec::new(); // Add each feature #[cfg(feature = "send2")] versions.push("v2"); #[cfg(feature = "send3")] versions.push("v3"); versions } /// Follow redirects on the given URL, and return the final full URL. /// /// This is used to obtain share URLs from shortened links. /// // TODO: extract this into module pub fn follow_url(client: &Client, url: &Url) -> Result { // Send the request, follow the URL, ensure success let response = client .get(url.as_str()) .send() .map_err(FollowError::Request)?; ensure_success(&response)?; // Obtain the final URL Ok(response.url().clone()) } /// URL following error. #[derive(Debug, Fail)] pub enum FollowError { /// Failed to send the shortening request. #[fail(display = "failed to send URL follow request")] Request(#[cause] reqwest::Error), /// The server responded with a bad response. #[fail(display = "failed to shorten URL, got bad response")] Response(#[cause] ResponseError), } impl From for FollowError { fn from(err: ResponseError) -> Self { FollowError::Response(err) } } /// Generate a random alphanumeric string with the given length. pub fn rand_alphanum_string(len: usize) -> String { let mut rng = thread_rng(); iter::repeat(()) .map(|()| rng.sample(Alphanumeric) as char) .take(len) .collect() } /// Read file from stdin. pub fn stdin_read_file(prompt: bool) -> Result, StdinErr> { if prompt { #[cfg(not(windows))] eprintln!("Enter input. Use [CTRL+D] to stop:"); #[cfg(windows)] eprintln!("Enter input. Use [CTRL+Z] to stop:"); } let mut data = vec![]; io::stdin() .lock() .read_to_end(&mut data) .map_err(StdinErr::Stdin)?; Ok(data) } /// URL following error. #[derive(Debug, Fail)] pub enum StdinErr { #[fail(display = "failed to read from stdin")] Stdin(#[cause] io::Error), }