The application has the ability to accept arguments at startup. They can be different.
That is, depending on the previous one and the subsequent argument may be different.
How do I start the application from the snap to show the valid arguments?
Thx.
I found what I need, this bash_completion
In snapcraft.yaml I have
name: abc
version: "0.1.0"
summary: backup
description: |
abc Agent for Linux a simple, FREE backup agent designed to ensure
the Availability of your Linux server instances, whether they reside in the
public cloud or on premises.
confinement: classic
architectures: [amd64]
apps:
abc:
command: usr/bin/abc
plugs: [home]
abcconfig:
command: usr/bin/abcconfig
completer: etc/bash_completion.d/abc
But when I try to add to the command (abc.abcconfig), nothing happens.
Maybe something else is required in the config to configure?
Can someone work with this, or know how to make it work?
Have you tried following
snap run --command=complete abc.abcconfig 9 9 18 1 " " 'abc.abcconfig ’ abc.abcconfig “”
- snap run --command=complete abc.abcconfig 9 9 18 1 ’ ’ 'abc.abcconfig ’ abc.abcconfig ‘’
/usr/lib/snapd/etelpmoc.sh: строка 128: complete: abc.abcconfig: there is no example of completion
Maybe this is something like the implementation of the script?
_abcconfig()
{
IFS=$'\n'
COMPREPLY=()
# echo "command=${COMP_WORDS[@]}"
# Call abcconfig in Bash-completion mode and store result in 'completedArgs'
completedArgs="$(ABC_BASH_COMPLETION=yes ${COMP_WORDS[@]} 2>&1)"
completedArgs_result=$?
# echo "completedArgs=${completedArgs}"
# echo "completedArgs_result=${completedArgs_result}"
# If argument completing was failed, exit
if [[ ${completedArgs_result} -gt 0 ]]; then
#echo "err"
return 0
fi
# Return completed arguments as result in Bash
IFS=$'\n' COMPREPLY=( $(echo "${completedArgs}") )
# echo "COMPREPLY=${COMPREPLY[@]}"
return 0
}
complete -F _abcconfig abcconfig
Maybe someone knows, maybe this problem will appear due to the implementation of the script itself?
And if the difference between veeamconfig and veeam.veeamconfig?
@chipaca Maybe you have some idea on this?
Sorry, I’m not sure what your question is.
The fact that you threw me above, the description for setting up bash_completion, it did not help me. If you see in the file snapcraft.yaml, then you can see that the name of the package is abc, and then comes abcconfig. When installing an application from the deb package, you need to write abcconfig, and in the case of a snap package, you need to wriye abc.abcconfig. Could this affect the operation of bash_completion? If yes, then how to correct the need to type the name of the package, and then the name of the application, and immediately write abcconfig?
Unless I’m misunderstadning, this is a question about veeam, not about snapd; I know nothing about veeam.
Rather, it’s about how snap works in such cases)
Is it possible to get rid of the need to type like this veeam.veeamconfig? That is, immediately type veeamconfig?
Maybe this is the whole problem.
Ah. I think I understand what you’re saying, and what you’re trying to ask, now.
The document I linked to is not a “fact”, it is a series of steps you can use to find the issue.
What were the results of each step? Which one failed?
In the evening I will go through the whole settings once again and write down what mistakes I saw. Once again, to clarify, is it possible to access the application without entering the snap package name?
yes, we call them “aliases”, the user can create them by hand, and you can request automatic ones:
This probably helps, as well: http://www.catb.org/~esr/faqs/smart-questions.html#beprecise
According to your advice, I went through the steps as described. In 4 points in the console I got this log:
...
+ [[ 2 -ge 2 ]]
+ _complete_from_snap abc.absconfig '' abc.abcconfig
+ read -r -a opts
++ snap run --command=complete abc.abcconfig 9 9 19 1 '
"'\''><=;|&(:' ' abc.abcconfig ' abc.abcconfig ''
+ [[ 1 -gt 0 ]]
+ [[ filenames == \c\a\n\n\o\t ]]
+ for i in "${opts[@]}"
+ [[ filenames =~ ^[a-z]+$ ]]
+ read -r bounced
+ case "$bounced" in
+ read -r sep
+ '[' -n '' ']'
...
snap run --command=complete abc.abcconfig 9 9 19 1 " " 'abc.abcconfig ' abc.abcconfig ""
/usr/lib/snapd/etelpmoc.sh: line 128: complete: abc.abcconfig: no completion specification
filenames
commands
dev
etc
lib
lib64
meta
run
sbin
snap
usr
var
command-abc.wrapper
command-abcconfig.wrapper
command-abcservice.wrapper
commands
dev
etc
lib
lib64
meta
run
sbin
snap
stop-command-abcservice.wrapper
usr
var
Where else can I looking for reason that this functionality does not work in the snap package? Thx.
From the text in step 4,
so, does your completion snippet set up a completer for your unaliased snap.app
command?
Double tapping the TAB key does not supplement the arguments. (This works if the application is installed from the deb package.)
But, if I enter arguments from memory, then it works.
It appears that the completion rules doesn’t cover the unaliased snap launch command (_snap_name_._app_name_
), that’s why it won’t work.
You have to implement one and patch it into the providing part.