Guest User

Untitled

a guest
Apr 12th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.02 KB | None | 0 0
  1. diff --git a/CMake/exec2man.sh b/CMake/exec2man.sh
  2. index b0807fc61..debff99c6 100755
  3. --- a/CMake/exec2man.sh
  4. +++ b/CMake/exec2man.sh
  5. @@ -1,5 +1,5 @@
  6. #!/bin/bash
  7. -# Convert the output of an MLPACK executable into a man page. This assumes that
  8. +# Convert the output of an mlpack executable into a man page. This assumes that
  9. # the CLI subsystem is used to output help, that the executable is properly
  10. # documented, and that the program is run in the directory that the executable
  11. # is in. Usually, this is used by CMake on Linux/UNIX systems to generate the
  12. @@ -17,7 +17,7 @@ output="$2"
  13. # Generate the synopsis.
  14. # First, required options.
  15. reqoptions=`./"$name" -h | \
  16. - awk '/Required options:/,/Options:/' | \
  17. + awk '/Required input options:/,/Optional input options:/' | \
  18. grep '^ --' | \
  19. sed 's/^ --/--/' | \
  20. sed 's/^--[A-Za-z0-9_-]* (\(-[A-Za-z0-9]\))/\1/' | \
  21. @@ -31,7 +31,7 @@ reqoptions=`./"$name" -h | \
  22.  
  23. # Then, regular options.
  24. options=`./"$name" -h | \
  25. - awk '/Options:/,/For further information,/' | \
  26. + awk '/Optional input options:/,/For further information,/' | \
  27. grep '^ --' | \
  28. sed 's/^ --/--/' | \
  29. grep -v -- '--help' | \
  30. @@ -50,7 +50,7 @@ options=`./"$name" -h | \
  31. sed 's/\(-[A-Za-z0-9] [a-z]*\) /\[\1\] /g' | \
  32. sed 's/\(--[A-Za-z0-9_-]* [a-z]*\) /\[\1\] /g'`
  33.  
  34. -synopsis="$name [-h] [-v] $reqoptions $options";
  35. +synopsis="$name $reqoptions $options [-h -v]";
  36.  
  37. # Preview the whole thing first.
  38. #./$name -h | \
  39. @@ -68,13 +68,12 @@ synopsis="$name [-h] [-v] $reqoptions $options";
  40. ./"$name" -h | \
  41. sed 's/^For further information/Additional Information\n\n For further information/' | \
  42. sed 's/^consult the documentation/ consult the documentation/' | \
  43. - sed 's/^distribution of MLPACK./ distribution of MLPACK./' | \
  44. + sed 's/^distribution of mlpack./ distribution of mlpack./' | \
  45. awk -v syn="$synopsis" \
  46. '{ if (NR == 1) print "NAME\n '"$name"' - "tolower($0)"\nSYNOPSIS\n "syn" \nDESCRIPTION\n" ; else print } ' | \
  47. sed '/^[^ ]/ y/qwertyuiopasdfghjklzxcvbnm:/QWERTYUIOPASDFGHJKLZXCVBNM /' | \
  48. sed 's/ / /g' | \
  49. - awk '/NAME/,/REQUIRED OPTIONS/ { print; } /ADDITIONAL INFORMATION/,0 { print; } /REQUIRED OPTIONS/,/ADDITIONAL INFORMATION/ { if (!/REQUIRED_OPTIONS/ && !/OPTIONS/ && !/ADDITIONAL INFORMATION/) { if (/ --/) { printf "\n" } sub(/^[
  50. ]*/, ""); sub(/ [ ]*/, " "); printf "%s ", $0; } else { if (!/REQUIRED OPTIONS/ && !/ADDITIONAL INFORMATION/) { print "\n"$0; } } }' | \
  51. + awk '/NAME/,/.*OPTIONS/ { if (!/.*OPTIONS/) { print; } } /ADDITIONAL INFORMATION/,0 { print; } /.*OPTIONS/,/ADDITIONAL INFORMATION/ { if (!/REQUIRED INPUT OPTIONS/ && !/OPTIONAL INPUT OPTIONS/ && !/OPTIONAL OUTPUT OPTIONS/ && !/AD
  52. DITIONAL INFORMATION/) { if (/ --/) { printf "\n" } sub(/^[ ]*/, ""); sub(/ [ ]*/, " "); printf "%s ", $0; } else { if (!/ADDITIONAL INFORMATION/) { print "\n"$0; } } }' | \
  53. sed 's/ ADDITIONAL INFORMATION/\n\nADDITIONAL INFORMATION/' | \
  54. txt2man -P mlpack -t "$name" -d 1 | \
  55. sed "s/^'/\\\\(aq/" > "$output"
  56. -
Add Comment
Please, Sign In to add comment