abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
abcpy_test Namespace Reference

Functions

def pytest1_cmd
 
def pytest2_cmd
 
def pytest3_cmd
 

Function Documentation

def abcpy_test.pytest1_cmd (   args)

Definition at line 9 of file abcpy_test.py.

9 
10 def pytest1_cmd(args):
11  print args
12  return 0
13 
14 # registers the command:
15 # The first argument is the function
16 # The second argument is the category (mainly for the ABC help command)
17 # The third argument is the new command name
18 # Keet the fourth argument 0, or consult with Alan
19 pyabc.add_abc_command(pytest1_cmd, "Python-Test", "pytest1", 0)
20 
# a simple command that just prints its arguments and runs the command 'scorr -h'
def pytest1_cmd
Definition: abcpy_test.py:9
def abcpy_test.pytest2_cmd (   args)

Definition at line 21 of file abcpy_test.py.

21 
22 def pytest2_cmd(args):
23  print args
24  pyabc.run_command('scorr -h')
25  return 0
26 
27 pyabc.add_abc_command(pytest2_cmd, "Python-Test", "pytest2", 0)
28 
29 # Now a more complicated command with argument parsing
30 # This command gets two command line arguments -c and -v. -c cmd runs the command 'cmd -h' and -v prints the python version
31 # for more details see the optparse module: http://docs.python.org/library/optparse.html
def pytest2_cmd
Definition: abcpy_test.py:21
def abcpy_test.pytest3_cmd (   args)

Definition at line 34 of file abcpy_test.py.

34 
35 def pytest3_cmd(args):
36  usage = "usage: %prog [options]"
37 
38  parser = optparse.OptionParser(usage, prog="pytest3")
39 
40  parser.add_option("-c", "--cmd", dest="cmd", help="command to ask help for")
41  parser.add_option("-v", "--version", action="store_true", dest="version", help="display Python Version")
42 
43  options, args = parser.parse_args(args)
44 
45  if options.version:
46  print sys.version
47  return 0
48 
49  if options.cmd:
50  pyabc.run_command("%s -h"%options.cmd)
51  return 0
52 
53  return 0
54 
55 pyabc.add_abc_command(pytest3_cmd, "Python-Test", "pytest3", 0)
def pytest3_cmd
Definition: abcpy_test.py:34