Hi all, I'm writing completion for lp* tools from the cups suite and
I'm trying to include in each of the completion files a file
containing the common commands named lpcommon.fish:
---------------------------8<---------------------------------
#function shared by all the lp* tools completions
function __lp_classes
lpstat -c | sed -ne 's/^members of class \([^:]\+\):/\1/p'
end
function __lp_printers
lpstat -p | sed -ne 's/^printer \([^ ]\+\).*/\1/p'
end
function __lp_jobs
lpstat -o | cut -f1 -d" "
end
---------------------------8<---------------------------------
The I try to load it using . in a concrete completion file like this:
-------------------------8<-------------------
# completions for cups/lpstat 1.3.8
# load common functions
. lpcommon.fish
complete -c lpstat -s E -d "Forces encryption when connecting to the server"
complete -c lpstat -s R -d "Shows the ranking of print jobs"
complete -c lpstat -s U -x -a '(__fish_complete_users)' -d "[USERNAME]
Specifies an alternate username"
complete -c lpstat -s p -f -a '(__lp_printers)' -d "[PRINTER(S)] Shows the
printers and whether or not they are enabled for printing"
complete -c lpstat -s W -x -a "all completed not-completed" -d "[WHICH-JOBS]
Specifies which jobs to show"
complete -c lpstat -s a -f -a "(__lp_printers)' -d "[PRINTER(S)] Shows the
accepting state of printer queues"
complete -c lpstat -s c -x -a '(__lp_classes)' -d "[CLASS(ES)] Shows the
printer classes and the printers that belong to them"
...
--------------------------8<---------------------------------------
Unfortunately this doesn't seem to work, what I get for example with:
lpstat -p ...
[EMAIL PROTECTED] ~> lpstat -p .: Error encountered while sourcing file
“lpcommon.fish”:
.: No such file or directory
fish: Unknown command “__lp_printers”
Standard input: __lp_printers
^
in command substitution
called on standard input,
[EMAIL PROTECTED] ~> lpstat -p fish: Unknown command “__lp_printers”
Standard input: __lp_printers
^
in command substitution
called on standard input,
So I don't know which fish to take now ;-).
Possible workarounds: to replicate all the function in each lp*
completion file, but I'd prefer to avoid this.
TIA (ye I'll post here completions when I'll be finished with 'em).
Friendly regards.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users