Added a Unix man page and a script to generate it.

The --help output text was changed slightly as well.
This commit is contained in:
Leon Styhre 2020-07-16 14:24:48 +02:00
parent 10420eaac2
commit ff1f329bd0
5 changed files with 83 additions and 21 deletions

View file

@ -131,6 +131,7 @@ Assuming the default installation prefix `/usr/local` has been used, this is the
``` ```
/usr/local/bin/emulationstation /usr/local/bin/emulationstation
/usr/local/man/man6/emulationstation.6.gz
/usr/local/share/applications/emulationstation.desktop /usr/local/share/applications/emulationstation.desktop
/usr/local/share/emulationstation/LICENSE /usr/local/share/emulationstation/LICENSE
/usr/local/share/emulationstation/LICENSES/* /usr/local/share/emulationstation/LICENSES/*

View file

@ -124,6 +124,8 @@ if(WIN32)
else() else()
install(TARGETS emulationstation RUNTIME install(TARGETS emulationstation RUNTIME
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/emulationstation.6.gz
DESTINATION ${CMAKE_INSTALL_PREFIX}/man/man6)
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE install(FILES ${CMAKE_SOURCE_DIR}/LICENSE
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/emulationstation) DESTINATION ${CMAKE_INSTALL_PREFIX}/share/emulationstation)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/emulationstation.desktop install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/emulationstation.desktop

Binary file not shown.

View file

@ -276,28 +276,28 @@ bool parseArgs(int argc, char* argv[])
} }
else if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0) { else if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0) {
std::cout << std::cout <<
"EmulationStation Desktop Edition\n" "Usage: emulationstation [options]\n"
"An Emulator Front-end\n\n" "EmulationStation Desktop Edition, Emulator Front-end\n\n"
"Options:\n" "Options:\n"
"--resolution [width] [height] Try to force a particular resolution\n" " --resolution [width] [height] Try to force a particular resolution\n"
"--gamelist-only Skip automatic game ROM search, only read from gamelist.xml\n" " --gamelist-only Skip automatic game ROM search, only read from gamelist.xml\n"
"--ignore-gamelist Ignore the gamelist files (useful for troubleshooting)\n" " --ignore-gamelist Ignore the gamelist files (useful for troubleshooting)\n"
"--draw-framerate Display the framerate\n" " --draw-framerate Display the framerate\n"
"--no-exit Don't show the exit option in the menu\n" " --no-exit Don't show the exit option in the menu\n"
"--no-splash Don't show the splash screen\n" " --no-splash Don't show the splash screen\n"
"--debug Print debug information\n" " --debug Print debug information\n"
"--windowed Windowed mode, should be combined with --resolution\n" " --windowed Windowed mode, should be combined with --resolution\n"
"--fullscreen-normal Normal fullscreen mode\n" " --fullscreen-normal Normal fullscreen mode\n"
"--fullscreen-borderless Borderless fullscreen mode (always on top)\n" " --fullscreen-borderless Borderless fullscreen mode (always on top)\n"
"--vsync [1/on or 0/off] Turn vsync on or off (default is on)\n" " --vsync [1/on or 0/off] Turn vsync on or off (default is on)\n"
"--max-vram [size] Max VRAM to use in Mb before swapping\n" " --max-vram [size] Max VRAM to use in Mb before swapping\n"
" Set to at least 20 to avoid unpredictable behavior\n" " Set to at least 20 to avoid unpredictable behavior\n"
"--force-kid Force the UI mode to Kid\n" " --force-kid Force the UI mode to Kid\n"
"--force-kiosk Force the UI mode to Kiosk\n" " --force-kiosk Force the UI mode to Kiosk\n"
"--force-disable-filters Force the UI to ignore applied filters in gamelist\n" " --force-disable-filters Force the UI to ignore applied filters in gamelist\n"
"--home [path] Directory to use as home path\n" " --home [path] Directory to use as home path\n"
"--version, -v Displays version information\n" " --version, -v Display version information\n"
"--help, -h Summon a sentient, angry tuba\n"; " --help, -h Summon a sentient, angry tuba\n";
return false; // Exit after printing help. return false; // Exit after printing help.
} }
else { else {

59
tools/generate_man_page.sh Executable file
View file

@ -0,0 +1,59 @@
#!/usr/bin/bash
#
# generate_man_page.sh
# Generate a Unix manual page for EmulationStation Desktop Edition.
#
# This script only takes an optional argument which is the location to the ES binary.
# If not provided, the default path will be searched for the binary 'emulationstation'.
#
# The man page will be generated in the same directory as where the script is executed.
#
# The command help2man must be installed, or the script will fail.
#
# Leon Styhre
# 2020-07-16
#
if [ $# -ne 1 ]; then
ESBINARY=emulationstation
else
ESBINARY=$1
fi
TEMPFILE_INPUT=tempfile_input_$(date +%H%M%S)
TEMPFILE_OUTPUT=tempfile_output_$(date +%H%M%S)
TARGET_FILENAME=emulationstation.6
MAN_INCLUDE="
[NAME]
emulationstation - EmulationStation Desktop Edition
[DESCRIPTION]
EmulationStation Desktop Edition is a fast and flexible front-end for browsing and launching games from your multi-platform retro game collection.
It's intended to be used in conjunction with emulators such as the RetroArch cores.
[AUTHOR]
Alec \"Aloshi\" Lofquist (original version)
RetroPie Community (RetroPie fork)
Leon Styhre (Desktop Edition fork)
[SEE ALSO]
Full documentation is available at: <https://gitlab.com/leonstyhre/emulationstation-de/>
"
echo "${MAN_INCLUDE}" > $TEMPFILE_INPUT
help2man --section 6 --no-info --include $TEMPFILE_INPUT $ESBINARY > $TEMPFILE_OUTPUT
# Manual string replacements, these may need to be modified if changes are made to the
# command line --help output.
cat $TEMPFILE_OUTPUT | sed s/"EmulationStation Desktop Edition, Emulator Front\\\-end"/""/g | \
sed s/"Set to at least"/".br\nSet to at least"/ > $TARGET_FILENAME
gzip $TARGET_FILENAME
rm $TEMPFILE_INPUT
rm $TEMPFILE_OUTPUT