API-CLI
view release on metacpan or search on metacpan
examples/bash/digitaloceancl.bash view on Meta::CPAN
if [[ ${#COMPREPLY[*]} -eq 1 ]]; then # Only one completion
COMPREPLY=( ${COMPREPLY[0]%% -- *} ) # Remove ' -- ' and everything after
COMPREPLY="$(echo -e "$COMPREPLY" | sed -e 's/[[:space:]]*$//')"
fi
}
__digitaloceancl_dynamic_comp() {
local argname="$1"
local arg="$2"
local comp name desc cols desclength formatted
local max=0
while read -r line; do
name="$line"
desc="$line"
name="${name%$'\t'*}"
if [[ "${#name}" -gt "$max" ]]; then
max="${#name}"
fi
done <<< "$arg"
while read -r line; do
name="$line"
desc="$line"
name="${name%$'\t'*}"
desc="${desc/*$'\t'}"
if [[ -n "$desc" && "$desc" != "$name" ]]; then
# TODO portable?
cols=`tput cols`
[[ -z $cols ]] && cols=80
desclength=`expr $cols - 4 - $max`
formatted=`printf "'%-*s -- %-*s'" "$max" "$name" "$desclength" "$desc"`
comp="$comp$formatted"$'\n'
else
comp="$comp'$name'"$'\n'
fi
done <<< "$arg"
_digitaloceancl_compreply "$comp"
}
function __digitaloceancl_handle_options() {
local i j
examples/bash/githubcl.bash view on Meta::CPAN
if [[ ${#COMPREPLY[*]} -eq 1 ]]; then # Only one completion
COMPREPLY=( ${COMPREPLY[0]%% -- *} ) # Remove ' -- ' and everything after
COMPREPLY="$(echo -e "$COMPREPLY" | sed -e 's/[[:space:]]*$//')"
fi
}
__githubcl_dynamic_comp() {
local argname="$1"
local arg="$2"
local comp name desc cols desclength formatted
local max=0
while read -r line; do
name="$line"
desc="$line"
name="${name%$'\t'*}"
if [[ "${#name}" -gt "$max" ]]; then
max="${#name}"
fi
done <<< "$arg"
while read -r line; do
name="$line"
desc="$line"
name="${name%$'\t'*}"
desc="${desc/*$'\t'}"
if [[ -n "$desc" && "$desc" != "$name" ]]; then
# TODO portable?
cols=`tput cols`
[[ -z $cols ]] && cols=80
desclength=`expr $cols - 4 - $max`
formatted=`printf "'%-*s -- %-*s'" "$max" "$name" "$desclength" "$desc"`
comp="$comp$formatted"$'\n'
else
comp="$comp'$name'"$'\n'
fi
done <<< "$arg"
_githubcl_compreply "$comp"
}
function __githubcl_handle_options() {
local i j
examples/bash/metacpancl.bash view on Meta::CPAN
if [[ ${#COMPREPLY[*]} -eq 1 ]]; then # Only one completion
COMPREPLY=( ${COMPREPLY[0]%% -- *} ) # Remove ' -- ' and everything after
COMPREPLY="$(echo -e "$COMPREPLY" | sed -e 's/[[:space:]]*$//')"
fi
}
__metacpancl_dynamic_comp() {
local argname="$1"
local arg="$2"
local comp name desc cols desclength formatted
local max=0
while read -r line; do
name="$line"
desc="$line"
name="${name%$'\t'*}"
if [[ "${#name}" -gt "$max" ]]; then
max="${#name}"
fi
done <<< "$arg"
while read -r line; do
name="$line"
desc="$line"
name="${name%$'\t'*}"
desc="${desc/*$'\t'}"
if [[ -n "$desc" && "$desc" != "$name" ]]; then
# TODO portable?
cols=`tput cols`
[[ -z $cols ]] && cols=80
desclength=`expr $cols - 4 - $max`
formatted=`printf "'%-*s -- %-*s'" "$max" "$name" "$desclength" "$desc"`
comp="$comp$formatted"$'\n'
else
comp="$comp'$name'"$'\n'
fi
done <<< "$arg"
_metacpancl_compreply "$comp"
}
function __metacpancl_handle_options() {
local i j
lib/API/CLI/App/Spec.pm view on Meta::CPAN
}
}
my $apicall = $subcommands->{ uc $method } ||= {
op => 'apicall',
summary => "\U$method\E call",
subcommands => {},
};
my $desc = $config->{description};
$desc =~ s/\n.*//s;
if (length $desc > 30) {
$desc = substr($desc, 0, 50) . '...';
}
my $subcmd = $apicall->{subcommands}->{ $path } ||= {
summary => $desc,
parameters => \@parameters,
options => \@options,
};
}
}
share/completion/bash/apicli.bash view on Meta::CPAN
if [[ ${#COMPREPLY[*]} -eq 1 ]]; then # Only one completion
COMPREPLY=( ${COMPREPLY[0]%% -- *} ) # Remove ' -- ' and everything after
COMPREPLY="$(echo -e "$COMPREPLY" | sed -e 's/[[:space:]]*$//')"
fi
}
__apicli_dynamic_comp() {
local argname="$1"
local arg="$2"
local comp name desc cols desclength formatted
local max=0
while read -r line; do
name="$line"
desc="$line"
name="${name%$'\t'*}"
if [[ "${#name}" -gt "$max" ]]; then
max="${#name}"
fi
done <<< "$arg"
while read -r line; do
name="$line"
desc="$line"
name="${name%$'\t'*}"
desc="${desc/*$'\t'}"
if [[ -n "$desc" && "$desc" != "$name" ]]; then
# TODO portable?
cols=`tput cols`
[[ -z $cols ]] && cols=80
desclength=`expr $cols - 4 - $max`
formatted=`printf "'%-*s -- %-*s'" "$max" "$name" "$desclength" "$desc"`
comp="$comp$formatted"$'\n'
else
comp="$comp'$name'"$'\n'
fi
done <<< "$arg"
_apicli_compreply "$comp"
}
function __apicli_handle_options() {
local i j
( run in 0.643 second using v1.01-cache-2.11-cpan-65fba6d93b7 )