Merge remote-tracking branch 'origin/main' into main

This commit is contained in:
fenix 2021-04-27 20:01:53 -07:00
commit 72890b966e
10 changed files with 131 additions and 249 deletions

View file

@ -1,5 +1,26 @@
--- ---
name: Bug Report name: "\U0001F41B Bug Report"
about: Create a bug report about: "If something isn't working as expected."
labels: bug labels: bug
--- ---
Thank you for taking the time to file an issue!
You can erase any parts of this template not applicable to your issue.
## In Case of Graphical, or Performance Issues
Please run `zellij --debug` and then recreate your issue.
Please attach the files that were created in
`/tmp/zellij/zellij-log/`
To the extent you are comfortable with.
Also please add the size in columns/lines of the terminal in which the bug happened. You can usually find these out with `tput lines` and `tput cols`.
And the name and version of progams you interacted with as well as
the operating system.
## Information
`zellij --version`:

89
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,89 @@
name: release
on:
push:
tags:
- 'v*.*.*'
jobs:
build-release:
needs: create-release
name: build-release
runs-on: ${{ matrix.os }}
env:
RUST_BACKTRACE: 1
strategy:
matrix:
build:
- linux musl x64
- macos x64
include:
- build: linux musl x64
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-musl
- build: macos x64
os: macos-latest
rust: stable
target: x86_64-apple-darwin
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Add WASM target
run: rustup target add wasm32-wasi
- name: Install cargo-make
run: cargo install --debug cargo-make
- name: Install musl-tools
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y --no-install-recommends musl-tools
- name: Install wasm-opt
run: brew install binaryen
- name: Build release binary
run: cargo make ci-build-release ${{ matrix.target }}
- name: Strip release binary
run: strip "target/${{ matrix.target }}/release/zellij"
- name: Tar release
id: make-artifact
working-directory: ./target/${{ matrix.target }}/release
run: |
name="zellij-${GITHUB_REF#refs/tags/}-${{ matrix.target }}.tar.gz"
tar cvfz "${name}" "zellij"
echo "::set-output name=name::${name}"
- name: Upload release archive
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./target/${{ matrix.target }}/release/${{ steps.make-artifact.outputs.name }}
asset_name: zellij-v${{ github.event.release.tag_name }}-${{matrix.target}}.tar.gz
asset_content_type: application/octet-stream
create-release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: create_release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

1
.gitignore vendored
View file

@ -2,3 +2,4 @@
*.new *.new
.vscode .vscode
.vim .vim
.DS_Store

View file

@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
## [Unreleased] ## [Unreleased]
* Doesn't quit anymore on single `q` press while in tab mode (https://github.com/zellij-org/zellij/pull/342) * Doesn't quit anymore on single `q` press while in tab mode (https://github.com/zellij-org/zellij/pull/342)
* Completions are not assets anymore, but commands `option --generate-completion [shell]` (https://github.com/zellij-org/zellij/pull/369)
## [0.5.1] - 2021-04-23 ## [0.5.1] - 2021-04-23
* Change config to flag (https://github.com/zellij-org/zellij/pull/300) * Change config to flag (https://github.com/zellij-org/zellij/pull/300)

View file

@ -1,90 +0,0 @@
#compdef zellij
autoload -U is-at-least
_zellij() {
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[@]}" \
'-s+[Send "split (direction h == horizontal / v == vertical)" to active zellij session]' \
'--split=[Send "split (direction h == horizontal / v == vertical)" to active zellij session]' \
'-o+[Send "open file in new pane" to active zellij session]' \
'--open-file=[Send "open file in new pane" to active zellij session]' \
'--max-panes=[Maximum panes on screen, caution: opening more panes will close old ones]' \
'--data-dir=[Change where zellij looks for layouts and plugins]' \
'-l+[Path to a layout yaml file]' \
'--layout=[Path to a layout yaml file]' \
'-c+[Change where zellij looks for the configuration]' \
'--config=[Change where zellij looks for the configuration]' \
'-m[Send "move focused pane" to active zellij session]' \
'--move-focus[Send "move focused pane" to active zellij session]' \
'-d[]' \
'--debug[]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
":: :_zellij_commands" \
"*::: :->zellij" \
&& ret=0
case $state in
(zellij)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:zellij-command-$line[1]:"
case $line[1] in
(option)
_arguments "${_arguments_options[@]}" \
'--clean[Disables loading of configuration file at default location]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
esac
;;
esac
}
(( $+functions[_zellij_commands] )) ||
_zellij_commands() {
local commands; commands=(
"option:Change the behaviour of zellij" \
"help:Prints this message or the help of the given subcommand(s)" \
)
_describe -t commands 'zellij commands' commands "$@"
}
(( $+functions[_zellij__help_commands] )) ||
_zellij__help_commands() {
local commands; commands=(
)
_describe -t commands 'zellij help commands' commands "$@"
}
(( $+functions[_zellij__option_commands] )) ||
_zellij__option_commands() {
local commands; commands=(
)
_describe -t commands 'zellij option commands' commands "$@"
}
_zellij "$@"

View file

@ -1,117 +0,0 @@
_zellij() {
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
zellij)
cmd="zellij"
;;
help)
cmd+="__help"
;;
option)
cmd+="__option"
;;
*)
;;
esac
done
case "${cmd}" in
zellij)
opts=" -m -d -h -V -s -o -l -c --move-focus --debug --help --version --split --open-file --max-panes --data-dir --layout --config option help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--split)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-s)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--open-file)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-o)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--max-panes)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--data-dir)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--layout)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-l)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--config)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-c)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
zellij__help)
opts=" -h -V --help --version "
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
zellij__option)
opts=" -h -V --clean --help --version "
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _zellij -o bashdefault -o default zellij

View file

@ -1,17 +0,0 @@
complete -c zellij -n "__fish_use_subcommand" -s s -l split -d 'Send "split (direction h == horizontal / v == vertical)" to active zellij session'
complete -c zellij -n "__fish_use_subcommand" -s o -l open-file -d 'Send "open file in new pane" to active zellij session'
complete -c zellij -n "__fish_use_subcommand" -l max-panes -d 'Maximum panes on screen, caution: opening more panes will close old ones'
complete -c zellij -n "__fish_use_subcommand" -l data-dir -d 'Change where zellij looks for layouts and plugins'
complete -c zellij -n "__fish_use_subcommand" -s l -l layout -d 'Path to a layout yaml file'
complete -c zellij -n "__fish_use_subcommand" -s c -l config -d 'Change where zellij looks for the configuration'
complete -c zellij -n "__fish_use_subcommand" -s m -l move-focus -d 'Send "move focused pane" to active zellij session'
complete -c zellij -n "__fish_use_subcommand" -s d -l debug
complete -c zellij -n "__fish_use_subcommand" -s h -l help -d 'Prints help information'
complete -c zellij -n "__fish_use_subcommand" -s V -l version -d 'Prints version information'
complete -c zellij -n "__fish_use_subcommand" -f -a "option" -d 'Change the behaviour of zellij'
complete -c zellij -n "__fish_use_subcommand" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)'
complete -c zellij -n "__fish_seen_subcommand_from option" -l clean -d 'Disables loading of configuration file at default location'
complete -c zellij -n "__fish_seen_subcommand_from option" -s h -l help -d 'Prints help information'
complete -c zellij -n "__fish_seen_subcommand_from option" -s V -l version -d 'Prints version information'
complete -c zellij -n "__fish_seen_subcommand_from help" -s h -l help -d 'Prints help information'
complete -c zellij -n "__fish_seen_subcommand_from help" -s V -l version -d 'Prints version information'

View file

@ -1,23 +0,0 @@
use std::fs;
use structopt::clap::Shell;
include!("src/cli.rs");
const BIN_NAME: &str = "zellij";
fn main() {
// Generate Shell Completions
let mut clap_app = CliArgs::clap();
println!("cargo:rerun-if-changed=src/cli.rs");
let mut out_dir = std::env::var_os("CARGO_MANIFEST_DIR").unwrap();
out_dir.push("/assets/completions");
println!(
"Completion files will to added to this location: {:?}",
out_dir
);
fs::create_dir_all(&out_dir).unwrap();
clap_app.gen_completions(BIN_NAME, Shell::Bash, &out_dir);
clap_app.gen_completions(BIN_NAME, Shell::Zsh, &out_dir);
clap_app.gen_completions(BIN_NAME, Shell::Fish, &out_dir);
}

View file

@ -51,4 +51,7 @@ pub enum ConfigCli {
/// Disables loading of configuration file at default location /// Disables loading of configuration file at default location
clean: bool, clean: bool,
}, },
#[structopt(name = "generate-completion")]
GenerateCompletion { shell: String },
} }

View file

@ -45,6 +45,20 @@ pub fn main() {
let mut stream = UnixStream::connect(ZELLIJ_IPC_PIPE).unwrap(); let mut stream = UnixStream::connect(ZELLIJ_IPC_PIPE).unwrap();
let api_command = bincode::serialize(&ApiCommand::OpenFile(file_to_open)).unwrap(); let api_command = bincode::serialize(&ApiCommand::OpenFile(file_to_open)).unwrap();
stream.write_all(&api_command).unwrap(); stream.write_all(&api_command).unwrap();
} else if let Some(crate::cli::ConfigCli::GenerateCompletion { shell }) = opts.option {
let shell = match shell.as_ref() {
"bash" => structopt::clap::Shell::Bash,
"fish" => structopt::clap::Shell::Fish,
"zsh" => structopt::clap::Shell::Zsh,
"powerShell" => structopt::clap::Shell::PowerShell,
"elvish" => structopt::clap::Shell::Elvish,
other => {
eprintln!("Unsupported shell: {}", other);
std::process::exit(1);
}
};
let mut out = std::io::stdout();
CliArgs::clap().gen_completions_to("zellij", shell, &mut out);
} else { } else {
let os_input = get_os_input(); let os_input = get_os_input();
atomic_create_dir(ZELLIJ_TMP_DIR).unwrap(); atomic_create_dir(ZELLIJ_TMP_DIR).unwrap();