misc: update names for D-Bus service file and zsh autocompletion:

- using `li` as main shortcut for `libervia-cli` instead of `jp`
- fix outdated Python version in `_li` zsh completion shell
- following global name change, D-Bus service file is no `org.libervia.Libervia.service`
  and it launches `libervia-backend`
This commit is contained in:
Goffi 2021-03-21 18:14:41 +01:00
commit 3cee3eca89
3 changed files with 12 additions and 12 deletions

View file

@ -1,15 +1,15 @@
This directory contains files related to SàT but not directly used by it. This directory contains files related to Libervia but not directly used by it.
* file _jp: * file _li:
This is the completion file for zsh. To use it, you need to have it in a path accessible in your fpath variable, and to have completion activated. This can be done by the following commands in your .zshrc: This is the completion file for zsh. To use it, you need to have it in a path accessible in your fpath variable, and to have completion activated. This can be done by the following commands in your .zshrc:
### .zshrc completion ### ### .zshrc completion ###
fpath=(/path/to/directory/with/_jp/ $fpath) fpath=(/path/to/directory/with/_li/ $fpath)
autoload -U compinit autoload -U compinit
compinit compinit
### end of .zshrc completion ### ### end of .zshrc completion ###
Then, you should be able to complete a jp command line by pressing [TAB]. Then, you should be able to complete a li command line by pressing [TAB].
* org.libervia.Libervia.service: * org.libervia.Libervia.service:
This file is used by D-Bus to know how to launch the backend, you have to put in in D-Bus services dir (usually /usr/share/dbus-1/services) This file is used by D-Bus to know how to launch the backend, you have to put in in D-Bus services dir (usually /usr/share/dbus-1/services)

View file

@ -1,5 +1,5 @@
#compdef jp jp_dev #compdef li libervia-cli li_dev jp jp_dev
# jp: a SAT command line tool # Libervia CLI: Command Line Interface for Libervia
# Copyright (C) 2009-2016 Jérôme Poisson (goffi@goffi.org) # Copyright (C) 2009-2016 Jérôme Poisson (goffi@goffi.org)
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
@ -20,19 +20,19 @@
# - filtering imposibles arguments # - filtering imposibles arguments
# - arguments (jids, files) # - arguments (jids, files)
PYTHON='python2' PYTHON='python3'
local optionals subcommands arguments local optionals subcommands arguments
local context state state_descr line local context state state_descr line
typeset -A val_args typeset -A val_args
_jp() { _li() {
eval `/usr/bin/env $PYTHON 2> /dev/null <<- PYTHONEND eval `/usr/bin/env $PYTHON 2> /dev/null <<- PYTHONEND
import re import re
from subprocess import check_output from subprocess import check_output
# import sys # import sys
# words_raw="jp_dev " + ' '.join(sys.argv[1:]) # for debugging in a script # words_raw="li_dev " + ' '.join(sys.argv[1:]) # for debugging in a script
words_raw="$words" # $words is the command line currently completed words_raw="$words" # $words is the command line currently completed
words_all = words_raw.split() words_all = words_raw.split()
@ -104,7 +104,7 @@ _jp() {
current_args = [] current_args = []
while True: while True:
# parse jp's help recursively until words_no_opt doesn't correspond anymore to a subcommand # parse li's help recursively until words_no_opt doesn't correspond anymore to a subcommand
try: try:
current_args.append(words_no_opt.pop(0)) current_args.append(words_no_opt.pop(0))
jp_help = check_output(current_args + ['--help']) jp_help = check_output(current_args + ['--help'])
@ -138,4 +138,4 @@ _jp() {
} }
_jp "$@" _li "$@"

View file

@ -1,3 +1,3 @@
[D-BUS Service] [D-BUS Service]
Name=org.libervia.Libervia Name=org.libervia.Libervia
Exec=sat Exec=libervia-backend