Fix --help formatting.

* util/grub-mkconfig_lib.in (print_option_help): New function.
	(grub_fmt): Likewise.
	* util/grub-install.in: Use print_option_help and grub_fmt.
	* util/grub-kbdcomp.in: Likewise.
	* util/grub-mkconfig.in: Likewise.
	* util/grub-mknetdir.in: Likewise.
	* util/grub-mkrescue.in: Likewise.
	* util/grub-mkstandalone.in: Likewise.
	* util/grub-reboot.in: Likewise.
	* util/grub-set-default.in: Likewise.
	* util/powerpc/ieee1275/grub-mkrescue.in: Likewise.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-04-07 19:49:25 +02:00
parent 561ec77e2d
commit 9f9d3f69f4
11 changed files with 136 additions and 59 deletions

View File

@ -1,3 +1,19 @@
2012-04-07 Vladimir Serbinenko <phcoder@gmail.com>
Fix --help formatting.
* util/grub-mkconfig_lib.in (print_option_help): New function.
(grub_fmt): Likewise.
* util/grub-install.in: Use print_option_help and grub_fmt.
* util/grub-kbdcomp.in: Likewise.
* util/grub-mkconfig.in: Likewise.
* util/grub-mknetdir.in: Likewise.
* util/grub-mkrescue.in: Likewise.
* util/grub-mkstandalone.in: Likewise.
* util/grub-reboot.in: Likewise.
* util/grub-set-default.in: Likewise.
* util/powerpc/ieee1275/grub-mkrescue.in: Likewise.
2012-04-07 Vladimir Serbinenko <phcoder@gmail.com>
* linguas.sh: Remove autogenerated *.po.

View File

@ -87,30 +87,30 @@ usage () {
echo
gettext "Install GRUB on your drive." ; echo
echo
printf " -h, --help %s\n" "$(gettext "print this message and exit")"
printf " -v, --version %s\n" "$(gettext "print the version information and exit")"
printf " --modules=%-14s%s\n" "$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")"
print_option_help "-h, --help" "$(gettext "print this message and exit")"
print_option_help "-v, --version" "$(gettext "print the version information and exit")"
print_option_help "--modules=$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")"
dirmsg="$(gettext_printf "install GRUB images under the directory DIR/%s instead of the %s directory" "@grubdirname@" "$grubdir")"
printf " --boot-directory=%-7s%s\n" "$(gettext "DIR")" "$dirmsg"
print_option_help "--boot-directory=$(gettext "DIR")" "$dirmsg"
# TRANSLATORS: "TARGET" as in "target platform".
target_trans="$(gettext "TARGET")"
# TRANSLATORS: "current" refers to the platform user's currently running on
printf " --target=%-15s%s\n" "$target_trans" "$(gettext "install GRUB for TARGET platform [default=current]")"
printf " --directory=%-12s%s\n" "$(gettext "DIR")" "$(gettext "use GRUB images from DIR. Takes precedence over target")"
printf " --grub-setup=%-11s%s\n" "$(gettext "FILE")" "$(gettext "use FILE as grub-setup")"
printf " --grub-mkimage=%-9s%s\n" "$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")"
printf " --grub-mkrelpath=%-7s%s\n" "$(gettext "FILE")" "$(gettext "use FILE as grub-mkrelpath")"
printf " --grub-probe=%-11s%s\n" "$(gettext "FILE")" "$(gettext "use FILE as grub-probe")"
print_option_help "--target=$target_trans" "$(gettext "install GRUB for TARGET platform [default=current]")"
print_option_help "--directory=$(gettext "DIR")" "$(gettext "use GRUB images from DIR. Takes precedence over target")"
print_option_help "--grub-setup=$(gettext "FILE")" "$(gettext "use FILE as grub-setup")"
print_option_help "--grub-mkimage=$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")"
print_option_help "--grub-mkrelpath=$(gettext "FILE")" "$(gettext "use FILE as grub-mkrelpath")"
print_option_help "--grub-probe=$(gettext "FILE")" "$(gettext "use FILE as grub-probe")"
# TRANSLATORS: "may break" doesn't just mean that option wouldn't have any
# effect but that it will make the resulting install unbootable from HDD.
printf " --allow-floppy %s\n" "$(gettext "make the drive also bootable as floppy (default for fdX devices). May break on some BIOSes.")"
printf " --recheck %s\n" "$(gettext "delete device map if it already exists")"
printf " --force %s\n" "$(gettext "install even if problems are detected")"
printf " --force-file-id %s\n" "$(gettext "use identifier file even if UUID is available")"
printf " --disk-module=%-10s%s\n" "$(gettext "MODULE")" "$(gettext "disk module to use (biosdisk or native). This option is only available on BIOS target.")"
printf " --no-nvram %s\n" "$(gettext "don't update the \`boot-device' NVRAM variable. This option is only available on IEEE1275 targets.")"
printf " --removable %s\n" "$(gettext "the installation device is removable. This option is only available on EFI.")"
printf " --bootloader-id=%-8s%s\n" "$(gettext "ID")" "$(gettext "the ID of bootloader. This option is only available on EFI.")"
print_option_help "--allow-floppy" "$(gettext "make the drive also bootable as floppy (default for fdX devices). May break on some BIOSes.")"
print_option_help "--recheck" "$(gettext "delete device map if it already exists")"
print_option_help "--force" "$(gettext "install even if problems are detected")"
print_option_help "--force-file-id" "$(gettext "use identifier file even if UUID is available")"
print_option_help "--disk-module=$(gettext "MODULE")" "$(gettext "disk module to use (biosdisk or native). This option is only available on BIOS target.")"
print_option_help "--no-nvram" "$(gettext "don't update the \`boot-device' NVRAM variable. This option is only available on IEEE1275 targets.")"
print_option_help "--removable" "$(gettext "the installation device is removable. This option is only available on EFI.")"
print_option_help "--bootloader-id=$(gettext "ID")" "$(gettext "the ID of bootloader. This option is only available on EFI.")"
echo
gettext "INSTALL_DEVICE must be system device filename.";echo
echo

View File

@ -26,9 +26,9 @@ usage () {
gettext_printf "Usage: %s -o OUTPUT CKBMAP_ARGUMENTS...\n" "$self"
gettext "Make GRUB keyboard layout file."; echo
echo
printf " -h, --help %s\n" "$(gettext "print this message and exit")"
printf " -v, --version %s\n" "$(gettext "print the version information and exit")"
printf " -o, --output=%-11s%s\n" "$(gettext FILE)" "$(gettext "save output in FILE [required]")"
print_option_help "-h, --help" "$(gettext "print this message and exit")"
print_option_help "-v, --version" "$(gettext "print the version information and exit")"
print_option_help "-o, --output=$(gettext FILE)" "$(gettext "save output in FILE [required]")"
echo
gettext_printf "%s generates a keyboard layout for GRUB using ckbcomp\n" "$self"
echo

View File

@ -54,9 +54,9 @@ usage () {
gettext_printf "Usage: %s [OPTION]\n" "$self"
gettext "Generate a grub config file"; echo
echo
printf " -o, --output=%-11s%s\n" "$(gettext FILE)" "$(gettext "output generated config to FILE [default=stdout]")"
printf " -h, --help %s\n" "$(gettext "print this message and exit")"
printf " -v, --version %s\n" "$(gettext "print the version information and exit")"
print_option_help "-o, --output=$(gettext FILE)" "$(gettext "output generated config to FILE [default=stdout]")"
print_option_help "-h, --help" "$(gettext "print this message and exit")"
print_option_help "-v, --version" "$(gettext "print the version information and exit")"
echo
gettext "Report bugs to <bug-grub@gnu.org>."; echo
}

View File

@ -286,3 +286,65 @@ uses_abstraction () {
done
return 1
}
print_option_help () {
if test x$print_option_help_wc = x; then
if wc -L < /dev/null > /dev/null; then
print_option_help_wc=-L
elif wc -m < /dev/null > /dev/null; then
print_option_help_wc=-m
else
print_option_help_wc=-b
fi
fi
if test x$grub_have_fmt = x; then
if fmt -w 40 < /dev/null > /dev/null; then
grub_have_fmt=y;
else
grub_have_fmt=n;
fi
fi
print_option_help_lead=" $1"
print_option_help_lspace="$(echo "$print_option_help_lead" | wc $print_option_help_wc)"
print_option_help_fill="$((26 - print_option_help_lspace))"
echo -n "$print_option_help_lead"
if test $print_option_help_fill -le 0; then
print_option_help_nl=y
echo
else
print_option_help_i=0;
while test $print_option_help_i -lt $print_option_help_fill; do
echo -n " "
print_option_help_i=$((print_option_help_i+1))
done
print_option_help_nl=n
fi
if test x$grub_have_fmt = xy; then
print_option_help_split="$(echo "$2" | fmt -w 50)"
else
print_option_help_split="$2"
fi
if test x$print_option_help_nl = xy; then
echo "$print_option_help_split" | awk \
'{ print " " $0; }'
else
echo "$print_option_help_split" | awk 'BEGIN { n = 0 }
{ if (n == 1) print " " $0; else print $0; n = 1 ; }'
fi
}
grub_fmt () {
if test x$grub_have_fmt = x; then
if fmt -w 40 < /dev/null > /dev/null; then
grub_have_fmt=y;
else
grub_have_fmt=n;
fi
fi
if test x$grub_have_fmt = xy; then
fmt
else
cat
fi
}

View File

@ -64,12 +64,12 @@ usage () {
gettext_printf "Usage: %s [OPTION]\n" "$self"
gettext; echo "Install GRUB on your drive."; echo
echo
printf " -h, --help %s\n" "$(gettext "print this message and exit")"
printf " -v, --version %s\n" "$(gettext "print the version information and exit")"
printf " --modules=%-14s%s\n" "$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")"
printf " --net-directory=%-8s%s\n" "$(gettext "DIR")" "$(gettext "root directory of TFTP server")"
printf " --subdir=%-15s%s\n" "$(gettext "DIR")" "$(gettext "relative subdirectory on network server")"
printf " --grub-mkimage=%-9s%s" "$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")"
print_option_help "-h, --help" "$(gettext "print this message and exit")"
print_option_help "-v, --version" "$(gettext "print the version information and exit")"
print_option_help "--modules=$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")"
print_option_help "--net-directory=$(gettext "DIR")" "$(gettext "root directory of TFTP server")"
print_option_help "--subdir=$(gettext "DIR")" "$(gettext "relative subdirectory on network server")"
print_option_help "--grub-mkimage=$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")"
echo
gettext_printf "%s copies GRUB images into net_directory/subdir/target_cpu-platform\n" "$self"
echo

View File

@ -62,16 +62,16 @@ usage () {
gettext "Make GRUB CD-ROM, disk, pendrive and floppy bootable image."; echo
echo
filetrans="$(gettext FILE)"
printf " -h, --help %s\n" "$(gettext "print this message and exit")"
printf " -v, --version %s\n" "$(gettext "print the version information and exit")"
printf " -o, --output=%-11s%s\n" "$filetrans" "$(gettext "save output in FILE [required]")"
printf " --modules=%-14s%s\n" "$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")"
printf " --rom-directory=%-8s%s\n" "$(gettext "DIR")" "$(gettext "save ROM images in DIR [optional]")"
print_option_help "-h, --help" "$(gettext "print this message and exit")"
print_option_help "-v, --version" "$(gettext "print the version information and exit")"
print_option_help "-o, --output=$filetrans" "$(gettext "save output in FILE [required]")"
print_option_help "--modules=$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")"
print_option_help "--rom-directory=$(gettext "DIR")" "$(gettext "save ROM images in DIR [optional]")"
# TRANSLATORS: xorriso is a program for creating ISOs and burning CDs
printf " --xorriso=%-14s%s\n" "$filetrans" "$(gettext "use FILE as xorriso [optional]")"
printf " --grub-mkimage=%-9s%s\n" "$filetrans" "$(gettext "use FILE as grub-mkimage")"
print_option_help "--xorriso=$filetrans" "$(gettext "use FILE as xorriso [optional]")"
print_option_help "--grub-mkimage=$filetrans" "$(gettext "use FILE as grub-mkimage")"
echo
gettext_printf "%s generates a bootable rescue image with specified source files, source directories, or mkisofs options listed by the output of \`%s'\n" "xorriso -as mkisofs -help" "$self"
gettext_printf "%s generates a bootable rescue image with specified source files, source directories, or mkisofs options listed by the output of \`%s'\n" "xorriso -as mkisofs -help" "$self" | grub_fmt
echo
gettext "Option -- switches to native xorriso command mode."; echo
echo

View File

@ -55,19 +55,18 @@ usage () {
gettext_printf "Usage: %s [OPTION] SOURCE...\n" "$self"
gettext "Generate a standalone image (containing all modules) in the selected format"
echo
printf " -h, --help %s\n" "$(gettext "print this message and exit")"
printf " -v, --version %s\n" "$(gettext "print the version information and exit")"
printf " -o, --output=%-11s%s\n" "$(gettext FILE)" "$(gettext "save output in FILE [required]")"
print_option_help "-h, --help" "$(gettext "print this message and exit")"
print_option_help "-v, --version" "$(gettext "print the version information and exit")"
print_option_help "-o, --output=$(gettext FILE)" "$(gettext "save output in FILE [required]")"
# TRANSLATORS: platform here isn't identifier. It can be translated.
dir_msg="$(gettext_printf "use images and modules under DIR [default=%s/<platform>]" "${libdir}/@PACKAGE@")"
printf " -d, --directory=%-8s%s\n" \
"DIR" "$dir_msg"
printf " -O, --format=%-11s%s" "$(gettext "FORMAT")" "$(gettext "generate an image in FORMAT")"; echo
printf " %s %s\n" "$(gettext "available formats:")" "$formats"
print_option_help "-d, --directory=$(gettext "DIR")" "$dir_msg"
print_option_help "-O, --format=$(gettext "FORMAT")" "$(gettext "generate an image in FORMAT")"; echo
print_option_help "" "$(gettext "available formats:") $formats"
echo
printf " -C, --compression=(xz|none|auto) %s\n" "$(gettext "choose the compression to use")"
printf " --modules=%-14s%s\n" "$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")"
printf " --grub-mkimage=%-9s%s\n" "$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")"
print_option_help "-C, --compression=(xz|none|auto)" "$(gettext "choose the compression to use")"
print_option_help "--modules=$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")"
print_option_help "--grub-mkimage=$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")"
echo
gettext "Report bugs to <bug-grub@gnu.org>."; echo
}

View File

@ -48,10 +48,10 @@ usage () {
gettext_printf "Usage: %s [OPTION] MENU_ENTRY\n" "$self"
gettext "Set the default boot menu entry for GRUB, for the next boot only."; echo
echo
printf " -h, --help %s\n" "$(gettext "print this message and exit")"
printf " -v, --version %s\n" "$(gettext "print the version information and exit")"
print_option_help "-h, --help" "$(gettext "print this message and exit")"
print_option_help "-v, --version" "$(gettext "print the version information and exit")"
dirmsg="$(gettext_printf "expect GRUB images under the directory DIR/%s instead of the %s directory" "@grubdirname@" "$grubdir")"
printf " --boot-directory=%-7s%s\n" "$(gettext "DIR")" "$dirmsg"
print_option_help "--boot-directory=$(gettext "DIR")" "$dirmsg"
echo
gettext "MENU_ENTRY is a number, a menu item title or a menu item identifier."; echo
echo

View File

@ -48,10 +48,10 @@ usage () {
gettext_printf "Usage: %s [OPTION] MENU_ENTRY\n" "$self"
gettext "Set the default boot menu entry for GRUB."; echo
echo
printf " -h, --help %s\n" "$(gettext "print this message and exit")"
printf " -v, --version %s\n" "$(gettext "print the version information and exit")"
print_option_help "-h, --help" "$(gettext "print this message and exit")"
print_option_help "-v, --version" "$(gettext "print the version information and exit")"
dirmsg="$(gettext_printf "expect GRUB images under the directory DIR/%s instead of the %s directory" "@grubdirname@" "$grubdir")"
printf " --boot-directory=%-7s%s\n" "$(gettext "DIR")" "$dirmsg"
print_option_help "--boot-directory=$(gettext "DIR")" "$dirmsg"
echo
gettext "MENU_ENTRY is a number, a menu item title or a menu item identifier."; echo
echo

View File

@ -49,12 +49,12 @@ usage () {
gettext_printf "Usage: %s [OPTION] SOURCE...\n" "$self"
gettext "Make GRUB CD-ROM, disk, pendrive and floppy bootable image."; echo
echo
printf " -h, --help %s\n" "$(gettext "print this message and exit")"
printf " -v, --version %s\n" "$(gettext "print the version information and exit")"
printf " --modules=%-14s%s\n" "$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")"
printf " --grub-mkimage=%-9s%s\n" "$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")"
print_option_help "-h, --help" "$(gettext "print this message and exit")"
print_option_help "-v, --version" "$(gettext "print the version information and exit")"
print_option_help "--modules=$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")"
print_option_help "--grub-mkimage=$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")"
echo
gettext_printf "%s generates a bootable rescue image with specified source files, source directories, or mkisofs options listed by the output of \`%s'\n" "genisoimage -help" "$self"
gettext_printf "%s generates a bootable rescue image with specified source files, source directories, or mkisofs options listed by the output of \`%s'\n" "genisoimage -help" "$self" | grub_fmt
echo
gettext "Report bugs to <bug-grub@gnu.org>."; echo
}