summaryrefslogtreecommitdiff
path: root/xnt/xenant.py
diff options
context:
space:
mode:
authorkennyballou <kballou@onyx.boisestate.edu>2012-12-05 15:06:52 -0700
committerkballou <kballou@onyx.boisestate.edu>2012-12-05 15:06:52 -0700
commit1044f1f31f9939458d58598ed4b42ed78a8d6324 (patch)
tree82f17ecfd7aecb56a899d085274fcb9bc6996b26 /xnt/xenant.py
parentda00712cb4b811aa71222d4228ff3e0113449aab (diff)
downloadxnt-1044f1f31f9939458d58598ed4b42ed78a8d6324.tar.gz
xnt-1044f1f31f9939458d58598ed4b42ed78a8d6324.tar.xz
Add usage and "--usage" option
Diffstat (limited to 'xnt/xenant.py')
-rw-r--r--xnt/xenant.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/xnt/xenant.py b/xnt/xenant.py
index 3971f6d..96102bc 100644
--- a/xnt/xenant.py
+++ b/xnt/xenant.py
@@ -25,6 +25,10 @@ logging.basicConfig(format="%(asctime)s:%(levelname)s:%(message)s")
logger = logging.Logger(name=__name__)
logger.addHandler(logging.StreamHandler())
+def usageAction():
+ printUsage()
+ sys.exit(0)
+
def versionAction():
printVersion()
sys.exit(0)
@@ -33,6 +37,7 @@ def verboseAction():
logging.getLogger("xnt.tasks").setLevel(logging.INFO)
actions = {
+ "--usage": usageAction,
"--version": versionAction,
"-v" : verboseAction,
}
@@ -64,6 +69,21 @@ def invokeBuild(build, targetName):
except:
logger.error(sys.exc_info()[1].message)
+def printUsage():
+ import xnt
+ print(xnt.__version__)
+ print(xnt.__license__)
+ print("Usage:\txnt [options] [target]")
+ print("Where [target] is a target in your ``build.py`` file")
+ print(" And [options] is one of the falling:")
+ print("\t-v: print verbose information about Xnt's running")
+ print("\t--usage: Print this message")
+ print("In addition to targets defined by your ``build.py`` file")
+ print("\t``list-targets`` can be used in place of [targets] to")
+ print("\t\tlist targets and docstrings defined in your ``build.py`` file")
+ print("\tIf no [target] is provided, Xnt will try the target: ``default``")
+ print("\n")
+
def printVersion():
import xnt
print(xnt.__version__)