Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hg-pull-mirror-test2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
heptapod
Testing Projects
hg-pull-mirror-test2
Commits
cf930b24
Commit
cf930b24
authored
19 years ago
by
Thomas Arendsen Hein
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup of spacing in bash_completion
parent
063e0483
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
contrib/bash_completion
+38
-38
38 additions, 38 deletions
contrib/bash_completion
with
38 additions
and
38 deletions
contrib/bash_completion
+
38
−
38
View file @
cf930b24
...
@@ -4,23 +4,23 @@
...
@@ -4,23 +4,23 @@
{
{
"$hg" --debug help 2>/dev/null | \
"$hg" --debug help 2>/dev/null | \
awk 'function command_line(line) {
awk 'function command_line(line) {
gsub(/,/, "", line)
gsub(/,/, "", line)
gsub(/:.*/, "", line)
gsub(/:.*/, "", line)
split(line, aliases)
split(line, aliases)
command = aliases[1]
command = aliases[1]
delete aliases[1]
delete aliases[1]
print command
print command
for (i in aliases)
for (i in aliases)
if (index(command, aliases[i]) != 1)
if (index(command, aliases[i]) != 1)
print aliases[i]
print aliases[i]
}
}
/^list of commands:/ {commands=1}
/^list of commands:/ {commands=1}
commands && /^ debug/ {a[i++] = $0; next;}
commands && /^ debug/ {a[i++] = $0; next;}
commands && /^ [^ ]/ {command_line($0)}
commands && /^ [^ ]/ {command_line($0)}
/^global options:/ {exit 0}
/^global options:/ {exit 0}
END {for (i in a) command_line(a[i])}'
END {for (i in a) command_line(a[i])}'
}
}
_hg_option_list()
_hg_option_list()
{
{
...
@@ -22,9 +22,9 @@
...
@@ -22,9 +22,9 @@
}
}
_hg_option_list()
_hg_option_list()
{
{
"$hg" -v help $1 2>
/dev/null | \
"$hg" -v help $1 2>/dev/null | \
awk '/^ *-/ {
awk '/^ *-/ {
for (i = 1; i <= NF; i ++) {
for (i = 1; i <= NF; i ++) {
if (index($i, "-") != 1)
if (index($i, "-") != 1)
...
@@ -30,3 +30,3 @@
...
@@ -30,3 +30,3 @@
if (index($i, "-") != 1)
if (index($i, "-") != 1)
break;
break;
print $i;
print $i;
...
@@ -32,6 +32,6 @@
...
@@ -32,6 +32,6 @@
print $i;
print $i;
}
}
}'
}'
}
}
...
@@ -56,10 +56,10 @@
...
@@ -56,10 +56,10 @@
_hg_paths()
_hg_paths()
{
{
local paths="$("$hg" paths 2>
/dev/null | sed -e 's/ = .*$//')"
local paths="$("$hg" paths 2>/dev/null | sed -e 's/ = .*$//')"
COMPREPLY=(${COMPREPLY[@]:-} $(
compgen -W '$paths' -- "$cur"
))
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$paths' -- "$cur"))
}
}
_hg_repos()
_hg_repos()
{
{
local i
local i
...
@@ -61,12 +61,12 @@
...
@@ -61,12 +61,12 @@
}
}
_hg_repos()
_hg_repos()
{
{
local i
local i
for i in $(
compgen -d -- "$cur"
); do
for i in $(compgen -d -- "$cur"); do
test ! -d "$i"/.hg || COMPREPLY=(${COMPREPLY[@]:-} "$i")
test ! -d "$i"/.hg || COMPREPLY=(${COMPREPLY[@]:-} "$i")
done
done
}
}
_hg_status()
_hg_status()
{
{
...
@@ -68,11 +68,11 @@
...
@@ -68,11 +68,11 @@
done
done
}
}
_hg_status()
_hg_status()
{
{
local files="$(
"$hg" status -n$1 . 2>
/dev/null)"
local files="$("$hg" status -n$1 . 2>/dev/null)"
COMPREPLY=(${COMPREPLY[@]:-} $(
compgen -W '$files' -- "$cur"
))
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur"))
}
}
_hg_tags()
_hg_tags()
{
{
...
@@ -75,10 +75,10 @@
...
@@ -75,10 +75,10 @@
}
}
_hg_tags()
_hg_tags()
{
{
local tags="$("$hg" tags 2>
/dev/null |
local tags="$("$hg" tags 2>/dev/null |
sed -e 's/[0-9]*:[a-f0-9]\{40\}$//; s/ *$//')"
sed -e 's/[0-9]*:[a-f0-9]\{40\}$//; s/ *$//')"
COMPREPLY=(
${COMPREPLY[@]:-} $(compgen -W '$tags' -- "$cur")
)
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$tags' -- "$cur"))
}
}
# this is "kind of" ugly...
# this is "kind of" ugly...
...
@@ -87,7 +87,7 @@
...
@@ -87,7 +87,7 @@
local i count=0
local i count=0
local filters="$1"
local filters="$1"
for ((
i=1; $i<=$COMP_CWORD; i++
)); do
for ((i=1; $i<=$COMP_CWORD; i++)); do
if [[ "${COMP_WORDS[i]}" != -* ]]; then
if [[ "${COMP_WORDS[i]}" != -* ]]; then
if [[ ${COMP_WORDS[i-1]} == @($filters|$global_args) ]]; then
if [[ ${COMP_WORDS[i-1]} == @($filters|$global_args) ]]; then
continue
continue
...
@@ -113,7 +113,7 @@
...
@@ -113,7 +113,7 @@
# searching for the command
# searching for the command
# (first non-option argument that doesn't follow a global option that
# (first non-option argument that doesn't follow a global option that
# receives an argument)
# receives an argument)
for ((
i=1; $i<=$COMP_CWORD; i++
)); do
for ((i=1; $i<=$COMP_CWORD; i++)); do
if [[ ${COMP_WORDS[i]} != -* ]]; then
if [[ ${COMP_WORDS[i]} != -* ]]; then
if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then
if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then
cmd="${COMP_WORDS[i]}"
cmd="${COMP_WORDS[i]}"
...
@@ -125,7 +125,7 @@
...
@@ -125,7 +125,7 @@
if [[ "$cur" == -* ]]; then
if [[ "$cur" == -* ]]; then
opts=$(_hg_option_list $cmd)
opts=$(_hg_option_list $cmd)
COMPREPLY=(
${COMPREPLY[@]:-} $(compgen -W '$opts' -- "$cur")
)
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$opts' -- "$cur"))
return
return
fi
fi
...
@@ -147,7 +147,7 @@
...
@@ -147,7 +147,7 @@
fi
fi
# canonicalize command name
# canonicalize command name
cmd=$("$hg" -q help "$cmd" 2>
/dev/null | sed -e 's/^hg //; s/ .*//; 1q')
cmd=$("$hg" -q help "$cmd" 2>/dev/null | sed -e 's/^hg //; s/ .*//; 1q')
if [ "$cmd" != status ] && [ "$prev" = -r ] || [ "$prev" = --rev ]; then
if [ "$cmd" != status ] && [ "$prev" = -r ] || [ "$prev" = --rev ]; then
_hg_tags
_hg_tags
...
@@ -191,6 +191,6 @@
...
@@ -191,6 +191,6 @@
if [ $count = 1 ]; then
if [ $count = 1 ]; then
_hg_paths
_hg_paths
fi
fi
_hg_repos
_hg_repos
;;
;;
debugindex|debugindexdot)
debugindex|debugindexdot)
...
@@ -195,5 +195,5 @@
...
@@ -195,5 +195,5 @@
;;
;;
debugindex|debugindexdot)
debugindex|debugindexdot)
COMPREPLY=(${COMPREPLY[@]:-} $(
compgen -f -X "!*.i" -- "$cur"
))
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -f -X "!*.i" -- "$cur"))
;;
;;
debugdata)
debugdata)
...
@@ -198,8 +198,8 @@
...
@@ -198,8 +198,8 @@
;;
;;
debugdata)
debugdata)
COMPREPLY=(${COMPREPLY[@]:-} $(
compgen -f -X "!*.d" -- "$cur"
))
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -f -X "!*.d" -- "$cur"))
;;
;;
esac
esac
}
}
...
@@ -201,7 +201,7 @@
...
@@ -201,7 +201,7 @@
;;
;;
esac
esac
}
}
complete -o bashdefault -o default -F _hg hg 2>
/dev/null \
complete -o bashdefault -o default -F _hg hg 2>/dev/null \
|| complete -o default -F _hg hg
|| complete -o default -F _hg hg
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment