From 168187047328599da82ac739998712b6d87035b9 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 27 Aug 2012 17:14:54 +0200 Subject: [PATCH] begin manpage, begin integration of start/end tracking Signed-off-by: Nico Schottelius --- README | 130 +++++++++++++++++++++++++++++++++++++++++++- bin/ctt | 8 ++- lib/ctt/__init__.py | 3 + 3 files changed, 137 insertions(+), 4 deletions(-) diff --git a/README b/README index 397733b..26fe450 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ ctt - time tracking for geeks -ctt [list of tags] - starts time tracking +ctt - starts time tracking press ctrl-c to stop time tracking ctt -t|--track @@ -11,5 +11,131 @@ ctt --start "date" --stop "otherdate" Save to ~/.ctt/times// Dateformat: - YYYY-MM-DD-hh:mm:ss + YYYY-MM-DD + Report: + +cdist(1) +======== +Nico Schottelius + + +NAME +---- +cdist - Configuration management + + +SYNOPSIS +-------- +cdist [-h] [-V] + +cdist banner + +cdist config [-h] [-d] [-V] [-c CDIST_HOME] [-i MANIFEST] [-p] [-s] host [host ...] + + + +DESCRIPTION +----------- +cdist is the frontend executable to the cdist configuration management. +cdist supports different as explained below. The options to the main +program are: + +-h, --help:: + Show the help screen + +-V, --version:: + Show version and exit + + +BANNER +------- +Displays the cdist banner. + + +CONFIG +------ +Configure a system + +-h, --help:: + Show the help screen + +-c CDIST_HOME, --cdist-home CDIST_HOME:: + Instead of using the parent of the bin directory as cdist home, + use the specified directory + +-d, --debug:: + Enable debug output + +-i MANIFEST, --initial-manifest MANIFEST:: + Path to a cdist manifest or - to read from stdin + +-p, --parallel:: + Operate on multiple hosts in parallel + +-s, --sequential:: + Operate on multiple hosts sequentially + +--remote-copy REMOTE_COPY: + Command to use for remote copy (should behave like scp) + +--remote-exec REMOTE_EXEC: + Command to use for remote execution (should behave like ssh) + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +# Configure ikq05.ethz.ch with debug enabled +cdist config -d ikq05.ethz.ch + +# Configure hosts in parallel and use a different home directory +cdist config -c ~/p/cdist-nutzung \ + -p ikq02.ethz.ch ikq03.ethz.ch ikq04.ethz.ch + +# Use custom remote exec / copy commands +cdist config --remote-exec /path/to/my/remote/exec \ + --remote-copy /path/to/my/remote/copy \ + -p ikq02.ethz.ch ikq03.ethz.ch ikq04.ethz.ch + +# Display banner +cdist banner + +# Show help +cdist --help + +# Show Version +cdist --version +-------------------------------------------------------------------------------- + + +ENVIRONMENT +----------- +TMPDIR, TEMP, TMP:: + Setup the base directory for the temporary directory. + See http://docs.python.org/py3k/library/tempfile.html for + more information. This is rather useful, if the standard + directory used does not allow executables. + + +EXIT STATUS +----------- +The following exit values shall be returned: + +0:: + Successful completion +1:: + One or more host configurations failed + + +SEE ALSO +-------- +- cdist(7) +- cdist-reference(7) + + +COPYING +------- +Copyright \(C) 2011-2012 Nico Schottelius. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/bin/ctt b/bin/ctt index ac8dbd3..dd23532 100755 --- a/bin/ctt +++ b/bin/ctt @@ -51,15 +51,19 @@ def parse_argv(argv, version): parser['track'] = parser['sub'].add_parser('track', parents=[parser['loglevel']]) parser['track'].set_defaults(func=Tracker.commandline) + parser['track'].add_argument("-s", "--start", help="Start datetime (format: %s)" % ctt.DATETIMEFORMAT_PLAIN, + nargs=1) + parser['track'].add_argument("-e", "--end", help="End datetime (format: %s)" % ctt.DATETIMEFORMAT_PLAIN, + nargs=1) parser['track'].add_argument("project", help="Project to track time for", nargs=1) parser['report'] = parser['sub'].add_parser('report', parents=[parser['loglevel']]) parser['report'].set_defaults(func=Report.commandline) parser['report'].add_argument("project", help="Project to report time for", nargs=1) - parser['report'].add_argument("-s", "--start", help="Start datetime (first of last month)", + parser['report'].add_argument("-s", "--start", help="Start date (default: first of last month, format: %s)" % ctt.DATEFORMAT_PLAIN, nargs=1) - parser['report'].add_argument("-e", "--end", help="End datetime (last of last month)", nargs=1, + parser['report'].add_argument("-e", "--end", help="End date (default: last of last month, format: %s)" % ctt.DATEFORMAT_PLAIN, nargs=1, default=None) #parser['track'].add_argument("-t", "--tag", help="Add tags", diff --git a/lib/ctt/__init__.py b/lib/ctt/__init__.py index fe1dc54..8427c12 100644 --- a/lib/ctt/__init__.py +++ b/lib/ctt/__init__.py @@ -26,6 +26,9 @@ import os.path VERSION = "0.1" FILE_DELTA = "delta" DATEFORMAT = "%Y-%m-%d" +DATEFORMAT_PLAIN= DATEFORMAT.replace("%","") +DATETIMEFORMAT = "%Y-%m-%d-%H:%M" +DATETIMEFORMAT_PLAIN= DATETIMEFORMAT.replace("%","") class Error(Exception): pass