Browse Source

Autocompletion of journal command

master
Alice Gaudon 1 year ago
parent
commit
d3f9d1abe0
2 changed files with 22 additions and 2 deletions
  1. +13
    -0
      .zsh/functions/_journal
  2. +9
    -2
      .zshrc

+ 13
- 0
.zsh/functions/_journal View File

@ -0,0 +1,13 @@
#compdef journal
__systemctl () {
systemctl $_sys_service_mgr --full --no-legend --no-pager "$@" 2> /dev/null
}
(( $+functions[_journal_units] )) || _systemctl_get_non_template_names () {
echo -E - ${^${(R)${(f)"$(
__systemctl $mode list-unit-files "$PREFIX*"
__systemctl $mode list-units --all "$PREFIX*"
)"}:#*@.*}%%[[:space:]]*}
}
_wanted systemd-units expl unit compadd "$@" - $(_systemctl_get_non_template_names)

+ 9
- 2
.zshrc View File

@ -2,7 +2,7 @@
# Oh my zsh
export ZSH="/r/arisu/.oh-my-zsh"
export ZSH="$HOME/.oh-my-zsh"
plugins=(git)
COMPLETION_WAITING_DOTS="true"
ZSH_THEME="powerlevel10k/powerlevel10k" # `p10k configure`
@ -18,6 +18,7 @@ export LANG=en_US.UTF-8
# Auto completion
fpath=(~/.zsh/functions $fpath)
autoload -U compinit
zstyle ':completion:*' menu select
zmodload zsh/complist
@ -38,10 +39,16 @@ VISUAL=$EDITOR
## Aliases ##
setopt complete_aliases
alias dotgit='/usr/bin/git --git-dir=$HOME/dotfiles/ --work-tree=$HOME'
alias dotgit='git --git-dir=$HOME/dotfiles/ --work-tree=$HOME'
alias authy="/usr/bin/electron4 --app /usr/lib/authy/app.asar"
alias syslog="sudo journalctl -f | ccze"
journal() {
sudo journalctl -f -u $1 | ccze
}
# Random chars
rndanchars() {
openssl rand -base64 $1 | sed ':a;N;$!ba;s/\n//g' | sed 's/[+\/=]//g' | head -c $1


Loading…
Cancel
Save