bash-completion: use '\n' as IFS when ask for filenames

The bash completion for more(1) treats the space-separated pieces of
filenames as different files.

	$ touch foo\ bar
	$ more foo<TAB>
	bar foo

Reported-by: Ángel González <ingenit@zoho.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2013-09-30 15:49:00 +02:00
parent a1e276ae15
commit ce3e6b15e2
46 changed files with 49 additions and 0 deletions

View File

@ -6,6 +6,7 @@ _blkid_module()
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-c')
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -19,6 +19,7 @@ _colcrt_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -30,6 +30,7 @@ _column_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -33,6 +33,7 @@ _cytune_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- ${cur:-"/dev/tty"}) )
return 0

View File

@ -6,6 +6,7 @@ _dmesg_module()
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-F'|'--file')
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -20,6 +20,7 @@ _fallocate_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -18,6 +18,7 @@ _findmnt_module()
return 0
;;
'-F'|'--tab-file')
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -38,6 +38,7 @@ _flock_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- ${cur:-"/"}) )
return 0

View File

@ -6,6 +6,7 @@ _fsck.cramfs_module()
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-x'|'--destination')
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) )
return 0

View File

@ -40,6 +40,7 @@ _hexdump_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -6,6 +6,7 @@ _hwclock_module()
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-f'|'--rtc'|'--adjfile')
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -30,6 +30,7 @@ _ionice_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -6,6 +6,7 @@ _last_module()
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-f')
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -42,6 +42,7 @@ _ldattach_module()
return 0
;;
/*)
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -6,6 +6,7 @@ _logger_module()
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-f'|'--file')
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -20,6 +20,7 @@ _look_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -60,6 +60,7 @@ _losetup_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -42,6 +42,7 @@ _lscpu_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -38,6 +38,7 @@ _lslocks_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -6,6 +6,7 @@ _mcookie_module()
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-f'|'--file')
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -36,6 +36,7 @@ _mkfs.cramfs_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -28,6 +28,7 @@ _mkswap_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -21,6 +21,8 @@ _more_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -80,6 +80,7 @@ hfs nohfs romfs noromfs
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -20,6 +20,7 @@ _mountpoint_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- ${cur:-"/"}) )
return 0

View File

@ -16,6 +16,7 @@ _namei_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -40,6 +40,7 @@ _nsenter_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -25,6 +25,7 @@ _pg_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -11,6 +11,7 @@ _pivot_root_module()
esac
case $COMP_CWORD in
1|2)
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) )
;;

View File

@ -6,6 +6,7 @@ _readprofile_module()
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-m'|'--mapfile'|'-p'|'--profile')
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -24,6 +24,7 @@ _rename_module()
COMPREPLY=( $(compgen -W "replacement" -- $cur) )
;;
*)
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
;;

View File

@ -16,6 +16,7 @@ _rev_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -32,6 +32,7 @@ _script_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -24,6 +24,7 @@ _scriptreplay_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -45,6 +45,7 @@ _setterm_module()
return 0
;;
'-file')
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -14,6 +14,7 @@ _sfdisk_module()
return 0
;;
'-O'|'-I')
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -38,6 +38,7 @@ _su_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -24,6 +24,7 @@ _swaplabel_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -20,6 +20,7 @@ _tailf_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -44,6 +44,7 @@ _tunelp_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- ${cur:-"/dev/lp"}) )
return 0

View File

@ -25,6 +25,7 @@ _ul_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -16,6 +16,7 @@ _utmpdump_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -6,16 +6,19 @@ _uuidd_module()
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-p'|'--pid'|'-s'|'--socket')
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0
;;
'-T'|'--timeout')
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -W "timeout" -- $cur) )
return 0
;;
'-n'|'--uuids')
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -W "number" -- $cur) )
return 0

View File

@ -20,6 +20,7 @@ _wall_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- $cur) )
return 0

View File

@ -56,6 +56,7 @@ _wdctl_module()
return 0
;;
esac
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- ${cur:-"/dev/"}) )
return 0

View File

@ -6,6 +6,7 @@ _whereis_module()
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-B'|'-M'|'-S')
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) )
return 0