Skip to content

Commit

Permalink
Add completions
Browse files Browse the repository at this point in the history
[## v0.6.14 (2025-01-29), , - PR: <#265>, - Added command completions for subcommands and options, - Added dynamic completions for xvc_paths, storages, pipelines, pipeline steps, etc. , - Renamed xvc pipeline dag --format dot to graphviz, - Added experimental homebrew tap]
  • Loading branch information
iesahin authored Jan 29, 2025
1 parent 1ba3c08 commit 9c1c6bb
Show file tree
Hide file tree
Showing 122 changed files with 1,287 additions and 1,093 deletions.
133 changes: 2 additions & 131 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,6 @@ jobs:
# run: tree $GITHUB_WORKSPACE && xvc --version
run: xvc --version

# - name: Test
# if: matrix.coverage
# run: cargo test ${{ matrix.test-args }}
# env:
# CARGO_INCREMENTAL: "0"
# # To debug the output when commands fail
# TRYCMD: "dump"
# # RUSTFLAGS: "-Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off"
# RUSTFLAGS: "-Cinstrument-coverage"
# # RUSTDOCFLAGS: "-Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off"
# LLVM_PROFILE_FILE: "${TMPDIR}/xvc-%p-%m.profraw"
#
- name: Install cargo-llvm-cov
if: matrix.coverage
uses: taiki-e/install-action@cargo-llvm-cov
Expand All @@ -120,6 +108,8 @@ jobs:
env:
# To debug the output when commands fail
TRYCMD: "dump"
# Limit the docs we run tests
XVC_TRYCMD_TESTS: "storage,file,pipeline,core,start"

- name: Upload to codecov.io
if: matrix.coverage
Expand All @@ -131,122 +121,3 @@ jobs:
- name: Test all benches
if: matrix.benches
run: cargo test --benches ${{ matrix.features }}

# deploy-linux:
# name: deploy-linux
# needs: [coverage]
# if: startsWith(github.ref, 'refs/tags/')
# runs-on: ubuntu-latest
# strategy:
# matrix:
# target:
# [
# x86_64-unknown-linux-gnu,
# aarch64-unknown-linux-gnu,
# aarch64-linux-android,
# ]
#
# steps:
# - name: Checkout
# uses: actions/checkout@v1
#
# - name: Install rust
# uses: dtolnay/rust-toolchain@master
# with:
# toolchain: stable
# targets: ${{ matrix.target }}
#
# - name: Build target
# run: cargo build --release --target ${{ matrix.target }} --features=bundled-openssl
#
# - name: Package
# shell: bash
# run: |
# #strip target/${{ matrix.target }}/release/xvc
# cd target/${{ matrix.target }}/release
# tar czvf ../../../xvc-${{ github.ref_name }}-${{ matrix.target }}.tar.gz xvc
# cd -
#
# - name: Publish
# uses: softprops/action-gh-release@v1
# # TODO: if any of the build step fails, the release should be deleted.
# with:
# files: "xvc*"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#
# deploy-windows:
# name: deploy-windows
# needs: [coverage]
# if: startsWith(github.ref, 'refs/tags/')
# runs-on: windows-latest
# strategy:
# matrix:
# target: [x86_64-pc-windows-gnu]
# steps:
# - name: Checkout
# uses: actions/checkout@v1
#
# - name: Install rust
# uses: dtolnay/rust-toolchain@master
# with:
# toolchain: stable
# targets: ${{ matrix.target }}
#
# - name: Build target
# run: cargo build --release --target ${{ matrix.target }} --features bundled-sqlite
#
# - name: Package
# shell: bash
# run: |
# #strip target/${{ matrix.target }}/release/xvc
# cd target/${{ matrix.target }}/release
# tar czvf ../../../xvc-${{ github.ref_name}}-${{ matrix.target }}.tar.gz xvc
# cd -
#
# - name: Publish
# uses: softprops/action-gh-release@v1
# # TODO: if any of the build step fails, the release should be deleted.
# with:
# files: "xvc*"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#
# deploy-macos:
# name: deploy-macos
# needs: [coverage]
# if: startsWith(github.ref, 'refs/tags/')
# runs-on: macos-latest
# strategy:
# matrix:
# target:
# [x86_64-apple-darwin, aarch64-apple-darwin, x86_64-unknown-freebsd]
#
# steps:
# - name: Checkout
# uses: actions/checkout@v1
#
# - name: Install rust
# uses: dtolnay/rust-toolchain@master
# with:
# toolchain: stable
# targets: ${{ matrix.target }}
#
# - name: Build target
# run: cargo build --release --target ${{ matrix.target }}
#
# - name: Package
# shell: bash
# run: |
# #strip target/${{ matrix.target }}/release/xvc
# cd target/${{ matrix.target }}/release
# tar czvf ../../../xvc-${{ github.ref_name}}-${{ matrix.target }}.tar.gz xvc
# cd -
#
# - name: Publish
# uses: softprops/action-gh-release@v1
# # TODO: if any of the build step fails, the release should be deleted.
# with:
# files: "xvc*"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# Xvc Changelog

## Unreleased
## v0.6.14 (2025-01-29)

- PR: <https://github.com/iesahin/xvc/pull/265>
- Added command completions for subcommands and options
- Added dynamic completions for xvc_paths, storages, pipelines, pipeline steps, etc.
- Renamed xvc pipeline dag --format dot to graphviz
- Added experimental homebrew tap

## v0.6.13 (2024-12-30)
Expand Down
3 changes: 2 additions & 1 deletion book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- [Introduction](./intro/index.md)
- [Installation](./intro/install.md)
- [Completions](./intro/completions.md)
- [Compile without default features](./intro/compile-without-default-features.md)
- [Configuration](./intro/configuration.md)
- [Get Started](./start/index.md)
Expand Down Expand Up @@ -68,8 +69,8 @@
- [Utilities](./ref/utilities.md)
- [`xvc root`](./ref/xvc-root.md)
- [`xvc check-ignore`](./ref/xvc-check-ignore.md)
- [`xvc aliases`](./ref/xvc-aliases.md)
- [`xvc deinit`](./ref/xvc-deinit.md)
- [`xvc completions`](./ref/xvc-completions.md)

- [Rust API](./api/index.md)

Expand Down
43 changes: 43 additions & 0 deletions book/src/intro/completions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Adding completions to your shell

Xvc supports dynamic completions for bash, zsh, elvish, fish and powershell.

This means, when you hit `TAB` in your shell, it calls Xvc to complete the
command. Even paths that are not visible in your filesystem or pipeline and
step names are completed this way.

In order to activate completions, run the following commands once in your shell:

## Bash

```bash
echo "source <(COMPLETE=bash xvc)" >> ~/.bashrc
```

## Elvish

```sh
echo "eval (E:COMPLETE=elvish xvc | slurp)" >> ~/.elvish/rc.elv
```

## Fish

```sh
echo "source (COMPLETE=fish xvc | psub)" >> ~/.config/fish/config.fish
```

## Powershell

```sh
$env:COMPLETE = "powershell"
echo "xvc | Out-String | Invoke-Expression" >> $PROFILE
Remove-Item Env:\COMPLETE
```

## Zsh

```sh
echo "source <(COMPLETE=zsh xvc)" >> ~/.zshrc
```


84 changes: 0 additions & 84 deletions book/src/ref/xvc-aliases.md

This file was deleted.

2 changes: 1 addition & 1 deletion book/src/ref/xvc-file-bring.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

```console
$ xvc file bring --help
Bring (download, pull, fetch) files from external storages
Bring files from external storages

Usage: xvc file bring [OPTIONS] --storage <STORAGE> [TARGETS]...

Expand Down
4 changes: 2 additions & 2 deletions book/src/ref/xvc-file-carry-in.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ Copies the file changes to cache.

```console
$ xvc file carry-in --help
Carry (commit) changed files to cache
Carry in changed files to cache

Usage: xvc file carry-in [OPTIONS] [TARGETS]...

Arguments:
[TARGETS]...
Files/directories to add
Files/directories to carry in to the cache

Options:
--text-or-binary <TEXT_OR_BINARY>
Expand Down
8 changes: 3 additions & 5 deletions book/src/ref/xvc-file-copy.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Arguments:
If the target ends with a slash, it's considered a directory and created if it doesn't exist.
If the number of source files is more than one, the destination must be a directory.
If the number of source files is more than one, the destination must be a directory. TODO: Add a tracked directory completer we can have a file or a directory that we track and not available or we don't track and available. It's similar situation to xvc_path_completer but we also need to check the local paths.

Options:
--recheck-method <RECHECK_METHOD>
Expand Down Expand Up @@ -130,10 +130,8 @@ $ perl -i -pe 's/a/ee/g' data.txt

$ xvc file copy data.txt data5.txt
? 1
[ERROR] File Error: Sources have changed, please carry-in or recheck following files before copying:
data.txt
Error: FileError { source: AnyhowError { source: Sources have changed, please carry-in or recheck following files before copying:
data.txt } }
[ERROR] File Error: Sources have changed, please carry-in or recheck following files before copying: data.txt
Error: FileError { source: SourcesHaveChanged { message: "Sources have changed, please carry-in or recheck following files before copying", files: "data.txt" } }

```

Expand Down
14 changes: 11 additions & 3 deletions book/src/ref/xvc-file-hash.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,23 @@ Get digest hash of files with the supported algorithms
Usage: xvc file hash [OPTIONS] [TARGETS]...

Arguments:
[TARGETS]... Files to process
[TARGETS]...
Files to process
NOTE: This uses the default completion as the command can work anywhere with any file

Options:
-a, --algorithm <ALGORITHM>
Algorithm to calculate the hash. One of blake3, blake2, sha2, sha3. All algorithm variants produce 32-bytes digest

--text-or-binary <TEXT_OR_BINARY>
For "text" remove line endings before calculating the digest. Keep line endings if "binary". "auto" (default) detects the type by checking 0s in the first 8Kbytes, similar to Git [default: auto]
For "text" remove line endings before calculating the digest. Keep line endings if "binary". "auto" (default) detects the type by checking 0s in the first 8Kbytes, similar to Git
[default: auto]

-h, --help
Print help
Print help (see a summary with '-h')

-V, --version
Print version

Expand Down
2 changes: 2 additions & 0 deletions book/src/ref/xvc-file-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Options:
- {{rts}}: recorded timestamp. The timestamp of the cached content.
The default format can be set with file.list.format in the config file.
TODO: Think how to add a completion to ListFormat

-s, --sort <SORT>
Sort criteria.
Expand Down
Loading

0 comments on commit 9c1c6bb

Please sign in to comment.