Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,27 +73,27 @@ jobs:
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
artifact_name: ${{ needs.documents.outputs.appname }}
asset_name: ${{ needs.documents.outputs.appname }}-${{ needs.documents.outputs.tag }}_linux_amd64
asset_name: ${{ needs.documents.outputs.appname }}-${{ needs.documents.outputs.tag }}_linux_arm64
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
artifact_name: ${{ needs.documents.outputs.appname }}
asset_name: ${{ needs.documents.outputs.appname }}-${{ needs.documents.outputs.tag }}_linux_arm64
asset_name: ${{ needs.documents.outputs.appname }}-${{ needs.documents.outputs.tag }}_linux_amd64
# - os: ubuntu-latest
# target: aarch64-pc-windows-gnullvm
# artifact_name: ${{ needs.documents.outputs.appname }}.exe
# asset_name: ${{ needs.documents.outputs.appname }}-${{ needs.documents.outputs.tag }}_windows_amd64
# asset_name: ${{ needs.documents.outputs.appname }}-${{ needs.documents.outputs.tag }}_windows_arm64
# - os: ubuntu-latest
# target: x86_64-pc-windows-gnu
# artifact_name: ${{ needs.documents.outputs.appname }}.exe
# asset_name: ${{ needs.documents.outputs.appname }}-${{ needs.documents.outputs.tag }}_windows_arm64
# asset_name: ${{ needs.documents.outputs.appname }}-${{ needs.documents.outputs.tag }}_windows_amd64
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: ${{ needs.documents.outputs.appname }}
asset_name: ${{ needs.documents.outputs.appname }}-${{ needs.documents.outputs.tag }}_darwin_amd64
asset_name: ${{ needs.documents.outputs.appname }}-${{ needs.documents.outputs.tag }}_darwin_arm64
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: ${{ needs.documents.outputs.appname }}
asset_name: ${{ needs.documents.outputs.appname }}-${{ needs.documents.outputs.tag }}_darwin_arm64
asset_name: ${{ needs.documents.outputs.appname }}-${{ needs.documents.outputs.tag }}_darwin_amd64
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
34 changes: 8 additions & 26 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,38 +1,20 @@
[package]
name = "sibling"
version = "2.0.0-beta-7"
description = "get next/previous sibling directory name."
[workspace]
members = [ "lib", "cli" ]

resolver = "3"

[workspace.package]
version = "2.0.1"
repository = "https://github.com/tamada/sibling"
homepage = "https://tamada.github.io/sibling"
readme = "README.md"
authors = [
"Haruaki Tamada <tamada_f@ke_cafebabe.jp>"
]
license = "WTFL"
license-file = "LICENSE"
categories = ["command-line-utilities"]
edition = "2021"

[package.metadata.wix]
upgrade-guid = "D4DB88AD-BA23-4F88-A9B4-74C774EBEA37"
path-guid = "5A8D6CFE-2D9B-4F9E-80F2-439C0D9E43BC"
license = false
eula = false

[dependencies]
clap = { version = "4.5.23", features = ["derive"] }
rand = "0.8.5"
rust-embed = "8.5.0"

[build-dependencies]
clap = { version = "4.5.5", features = ["derive"] }
clap_complete = "4.5.38"
toml = "0.8.19"

# The profile that 'cargo dist' will build with
[profile.dist]
inherits = "release"
lto = "thin"

# Config for 'cargo dist'
[workspace.metadata.dist]
# The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax)
Expand Down
42 changes: 42 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[private]
@default: help

VERSION := `grep '^version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/g'`

# show help message
@help:
echo "Task runner for Gixor {{ VERSION }} with Just"
echo "Usage: just <recipe>"
echo ""
just --list

formats:
cargo fmt -- --emit=files

clippy:
cargo clippy --all-targets --all-features -- -D warnings

build target = "": formats clippy
cargo build {{ target }}

test: (build "")
cargo llvm-cov --lcov --output-path target/coverage.lcov

# Generate completion files
completions:
cargo run -- --generate-completion-files --completion-out-dir assets/completions

prepare_site_build:
test -d docs/public || git worktree add -f docs/public gh-pages

# Generate the document site with Hugo
site: prepare_site_build
hugo -s site

# Build the docker image for gixor
docker:
docker build -t ghcr.io/tamada/btmeister:latest -t ghcr.io/tamada/btmeister:{{VERSION}} .

# Build the docker image for multiple platforms and push them into ghcr.io
docker_buildx:
docker buildx build --platform linux/arm64/v8,linux/amd64 --output=type=image,push=true -t ghcr.io/tamada/btmeister:latest -t ghcr.io/tamada/btmeister:{{VERSION}} .
6 changes: 5 additions & 1 deletion assets/completions/bash/sibling
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ _sibling() {

case "${cmd}" in
sibling)
opts="-a -l -p -P -s -t -i -h -V --csv --absolute --list --progress --parent --step --init --type --input --help --version [DIR]..."
opts="-a -l -p -P -s -t -i -h -V --csv --absolute --list --progress --parent --step --init --type --input --generate-completion-files --completion-out-dir --help --version [DIR]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand Down Expand Up @@ -53,6 +53,10 @@ _sibling() {
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--completion-out-dir)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
Expand Down
2 changes: 2 additions & 0 deletions assets/completions/elvish/sibling
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ set edit:completion:arg-completer[sibling] = {|@words|
cand --type 'specify the nexter type'
cand -i 'directory list from file, if FILE is "-", reads from stdin.'
cand --input 'directory list from file, if FILE is "-", reads from stdin.'
cand --completion-out-dir 'Output directory of completion files'
cand --csv 'print the result in the csv format'
cand -a 'print the directory name in the absolute path'
cand --absolute 'print the directory name in the absolute path'
Expand All @@ -34,6 +35,7 @@ set edit:completion:arg-completer[sibling] = {|@words|
cand --progress 'print the progress of traversing directories'
cand -P 'print parent directory, when no more sibling directories are found'
cand --parent 'print parent directory, when no more sibling directories are found'
cand --generate-completion-files 'Generate completion files'
cand -h 'Print help'
cand --help 'Print help'
cand -V 'Print version'
Expand Down
2 changes: 2 additions & 0 deletions assets/completions/fish/sibling
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ complete -c sibling -s s -l step -d 'specify the number of times to execute sibl
complete -c sibling -l init -d 'generate the initialize script for the shell' -r
complete -c sibling -s t -l type -d 'specify the nexter type' -r -f -a "{first\t'',last\t'',previous\t'',next\t'',random\t'',keep\t''}"
complete -c sibling -s i -l input -d 'directory list from file, if FILE is "-", reads from stdin.' -r
complete -c sibling -l completion-out-dir -d 'Output directory of completion files' -r -F
complete -c sibling -l csv -d 'print the result in the csv format'
complete -c sibling -s a -l absolute -d 'print the directory name in the absolute path'
complete -c sibling -s l -l list -d 'list the sibling directories'
complete -c sibling -s p -l progress -d 'print the progress of traversing directories'
complete -c sibling -s P -l parent -d 'print parent directory, when no more sibling directories are found'
complete -c sibling -l generate-completion-files -d 'Generate completion files'
complete -c sibling -s h -l help -d 'Print help'
complete -c sibling -s V -l version -d 'Print version'
2 changes: 2 additions & 0 deletions assets/completions/powershell/sibling
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Register-ArgumentCompleter -Native -CommandName 'sibling' -ScriptBlock {
[CompletionResult]::new('--type', '--type', [CompletionResultType]::ParameterName, 'specify the nexter type')
[CompletionResult]::new('-i', '-i', [CompletionResultType]::ParameterName, 'directory list from file, if FILE is "-", reads from stdin.')
[CompletionResult]::new('--input', '--input', [CompletionResultType]::ParameterName, 'directory list from file, if FILE is "-", reads from stdin.')
[CompletionResult]::new('--completion-out-dir', '--completion-out-dir', [CompletionResultType]::ParameterName, 'Output directory of completion files')
[CompletionResult]::new('--csv', '--csv', [CompletionResultType]::ParameterName, 'print the result in the csv format')
[CompletionResult]::new('-a', '-a', [CompletionResultType]::ParameterName, 'print the directory name in the absolute path')
[CompletionResult]::new('--absolute', '--absolute', [CompletionResultType]::ParameterName, 'print the directory name in the absolute path')
Expand All @@ -37,6 +38,7 @@ Register-ArgumentCompleter -Native -CommandName 'sibling' -ScriptBlock {
[CompletionResult]::new('--progress', '--progress', [CompletionResultType]::ParameterName, 'print the progress of traversing directories')
[CompletionResult]::new('-P', '-P ', [CompletionResultType]::ParameterName, 'print parent directory, when no more sibling directories are found')
[CompletionResult]::new('--parent', '--parent', [CompletionResultType]::ParameterName, 'print parent directory, when no more sibling directories are found')
[CompletionResult]::new('--generate-completion-files', '--generate-completion-files', [CompletionResultType]::ParameterName, 'Generate completion files')
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
[CompletionResult]::new('-V', '-V ', [CompletionResultType]::ParameterName, 'Print version')
Expand Down
2 changes: 2 additions & 0 deletions assets/completions/zsh/_sibling
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ _sibling() {
'--type=[specify the nexter type]:TYPE:(first last previous next random keep)' \
'-i+[directory list from file, if FILE is "-", reads from stdin.]:FILE:_default' \
'--input=[directory list from file, if FILE is "-", reads from stdin.]:FILE:_default' \
'--completion-out-dir=[Output directory of completion files]:DIR:_files' \
'--csv[print the result in the csv format]' \
'-a[print the directory name in the absolute path]' \
'--absolute[print the directory name in the absolute path]' \
Expand All @@ -31,6 +32,7 @@ _sibling() {
'--progress[print the progress of traversing directories]' \
'-P[print parent directory, when no more sibling directories are found]' \
'--parent[print parent directory, when no more sibling directories are found]' \
'--generate-completion-files[Generate completion files]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
Expand Down
40 changes: 0 additions & 40 deletions build.rs

This file was deleted.

17 changes: 17 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "sibling-cli"
readme = "README.md"
description = "get next/previous sibling directory name."
categories = ["command-line-utilities"]
repository.workspace = true
homepage.workspace = true
version.workspace = true
authors.workspace = true
edition.workspace = true

[dependencies]
clap = { version = "4.5.23", features = ["derive"] }
clap_complete = "4.5.38"
rust-embed = "8.5.0"
sibling = { path = "../lib"}
toml = "0.8.19"
109 changes: 109 additions & 0 deletions cli/src/cli.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
use std::path::PathBuf;

use clap::Parser;

#[derive(Debug, Parser)]
#[clap(version, author, about, arg_required_else_help = true)]
pub struct CliOpts {
#[clap(flatten)]
pub(crate) p_opts: PrintingOpts,

#[arg(
short,
long,
help = "specify the number of times to execute sibling",
value_name = "COUNT",
default_value_t = 1
)]
pub step: usize,

#[arg(
long,
help = "generate the initialize script for the shell",
value_name = "SHELL",
hide = true,
default_missing_value = "bash"
)]
pub init: Option<String>,

#[arg(short = 't', long = "type", help = "specify the nexter type", value_enum, default_value_t = sibling::NexterType::Next, value_name = "TYPE", ignore_case = true)]
pub nexter: sibling::NexterType,

#[arg(
short,
long,
help = "directory list from file, if FILE is \"-\", reads from stdin.",
value_name = "FILE"
)]
pub input: Option<String>,

#[arg(index = 1, help = "the target directory", value_name = "DIR")]
pub dirs: Vec<PathBuf>,

#[cfg(debug_assertions)]
#[clap(flatten)]
pub(crate) compopts: CompletionOpts,
}

#[cfg(debug_assertions)]
#[derive(Parser, Debug)]
pub(crate) struct CompletionOpts {
#[arg(
long = "generate-completion-files",
help = "Generate completion files",
hide = true
)]
pub(crate) completion: bool,

#[arg(
long = "completion-out-dir",
value_name = "DIR",
default_value = "assets/completions",
help = "Output directory of completion files",
hide = true
)]
pub(crate) dest: PathBuf,
}

#[derive(Debug, Parser)]
pub(crate) struct PrintingOpts {
#[arg(
long,
help = "print the result in the csv format",
default_value_t = false,
hide = true
)]
pub csv: bool,

#[arg(
short,
long,
help = "print the directory name in the absolute path",
default_value_t = false
)]
pub absolute: bool,

#[arg(
short,
long,
help = "list the sibling directories",
default_value_t = false
)]
pub list: bool,

#[arg(
short,
long,
help = "print the progress of traversing directories",
default_value_t = false
)]
pub progress: bool,

#[arg(
short = 'P',
long,
help = "print parent directory, when no more sibling directories are found",
default_value_t = false
)]
pub parent: bool,
}
Loading
Loading