man page! it's not finished yet but we're that much closer to the big leagues now, son

This commit is contained in:
Nicholas O'Connor 2017-06-28 19:22:34 -07:00
parent 27e4def375
commit ba5e0b64ca
3 changed files with 83 additions and 0 deletions

View File

@ -23,6 +23,8 @@ SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/cellar")
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
include(Ronn)
find_package(PythonInterp)
find_package(PythonModule)
find_python_module(cogapp REQUIRED)
@ -117,6 +119,9 @@ add_dependencies(cellar cog) # effectively redundant but a couple of the bin's
# files are cogged, so this is mostly for people
# looking at CMakeLists.txt for hints
generate_manpage(cellar 1)
add_manpage_target()
install(TARGETS cellar ${cellar_LIBRARIES}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib/cellar

41
cmake/Modules/Ronn.cmake Normal file
View File

@ -0,0 +1,41 @@
find_program(RONN ronn)
find_program(GZIP gzip)
if(NOT RONN OR NOT GZIP)
message(WARNING "Not generating manpages")
if(NOT RONN)
message(WARNING " ronn not installed")
endif(NOT RONN)
if (NOT GZIP)
message(WARNING " gzip (somehow) not installed")
endif(NOT GZIP)
macro(generate_manpage) # Empty, won't do anything
endmacro(generate_manpage)
macro(add_manpage_target) # ditto
endmacro(add_manpage_target)
else(NOT RONN OR NOT GZIP)
set(manpages)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/man")
macro(generate_manpage TARGET SECTION)
set(ronnfile "${CMAKE_SOURCE_DIR}/doc/${TARGET}.${SECTION}.ronn")
set(outfile "${CMAKE_CURRENT_BINARY_DIR}/man/${TARGET}.${SECTION}")
add_custom_command(OUTPUT "${outfile}"
DEPENDS "${ronnfile}"
COMMAND ${RONN}
# BULLSHIT: ronn doesn't let you specify your own output filenames,
# have to hack it with shell redirecting
ARGS -r --pipe "${ronnfile}" > "${outfile}"
)
add_custom_command(OUTPUT "${outfile}.gz"
DEPENDS "${outfile}"
COMMAND "${GZIP}"
ARGS -f "${outfile}"
)
set(manpages ${manpages} "${outfile}.gz")
endmacro(generate_manpage)
macro(add_manpage_target) # this is a macro so we can call it after we've generated all our manpages
add_custom_target(man ALL DEPENDS ${manpages})
install(FILES ${manpages} DESTINATION "${MAN_INSTALL_DIR}/man${SECTION}" OPTIONAL)
endmacro(add_manpage_target)
endif(NOT RONN OR NOT GZIP)

37
doc/cellar.1.ronn Normal file
View File

@ -0,0 +1,37 @@
cellar(1) - bottle management tool for WINE connoisseurs
========================================================
## SYNOPSIS
`cellar` [-dv] [-b <bottle>] [--] <command> <subargs>
## DESCRIPTION
`cellar` is a tool for managing WINE bottles. `cellar` arguments are divided like this:
* First, [GLOBAL OPTIONS][] are processed. These control things like program verbosity, which bottle to use,
and other settings that are relevant no matter what you're doing.
* Second, cellar takes a [COMMAND][#COMMANDS], and that command probably has its own set of arguments and flags.
TCLAP is generally used as the command line parser, which provides a -- argument to separate the command from
the global options (e.g. `cellar -v -- create bottlename`). If the program seems to be interpreting a flag
ambiguously, try this first.
## GLOBAL OPTIONS
* `-v`, `--verbose`:
Enable verbose output.
* `-d', `--dryrun`:
Don't actually do anything, just print what you would do. Implies `--verbose`.
* `-b`, `--bottle <bottlename>`:
Specify that you want to use the bottle named <bottlename>, instead of the one activated with the "cellar activate"
command.
## COMMANDS
TODO: Generate this.
## COPYRIGHT
Copyright © 2017 Nicholas O'Connor. Provided under the terms of the MIT license: https://opensource.org/licenses/MIT