From fd60c6ed314c93cf18e2b458dfd7587f84f89aa8 Mon Sep 17 00:00:00 2001 From: "Chakib (spike) Benziane" Date: Tue, 9 Jul 2013 00:23:32 +0200 Subject: [PATCH] force show help if no args given --- tmpbrowse/tmpbrowse.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tmpbrowse/tmpbrowse.py b/tmpbrowse/tmpbrowse.py index 27d565a..b03a43b 100755 --- a/tmpbrowse/tmpbrowse.py +++ b/tmpbrowse/tmpbrowse.py @@ -5,6 +5,7 @@ import argparse import os import subprocess import shutil +import sys CHROME_BIN = 'google-chrome' @@ -42,8 +43,8 @@ class SpawnChrome(object): shutil.rmtree(os.path.join(USER_DIRS, project)) - -if __name__ == '__main__': +def cli_run(): + """docstring for cli_run""" parser = argparse.ArgumentParser( description='Spawn a sandboxed chrome instance per project') parser.add_argument('-p', '--project-name', @@ -67,4 +68,9 @@ if __name__ == '__main__': if args[0].remove_project: spawn = SpawnChrome(args) spawn.rm_project(args[0].remove_project[0]) + if len(sys.argv) == 1: + parser.print_help() + +if __name__ == '__main__': + cli_run()