revert changes from 0178ac: don't require argv=sys.argv[1:]
authorAlexander Solovyov <piranha@piranha.org.ua>
Tue, 06 Apr 2010 16:02:08 +0300
changeset 111 e40251bf5a23
parent 110 8771073591aa
child 112 d9d45a5aa73f
revert changes from 0178ac: don't require argv=sys.argv[1:]
docs/changelog.rst
docs/overview.rst
opster.py
tests/test2
tests/test_opts.py
--- a/docs/changelog.rst	Tue Apr 06 15:57:48 2010 +0300
+++ b/docs/changelog.rst	Tue Apr 06 16:02:08 2010 +0300
@@ -4,12 +4,11 @@
 0.9.10
 ~~~~~~
 
- - **backward incompatible change**: if you are calling function to parse
-   command line, earlier you could write ``main()`` to accomplish that
-   task. This syntax is unavailable now (this will try to actually call a
-   function), and you should use ``main(argv=sys.argv[1:])``.
  - if default value of an option is a fuction, always call it (None is passed in
    case when option is not supplied)
+ - always call a function if it's default argument for an option
+ - some cleanup with better support for python 3
+ - initial support for autocompletion (borrowed from PIP)
 
 0.9.9
 ~~~~~
--- a/docs/overview.rst	Tue Apr 06 15:57:48 2010 +0300
+++ b/docs/overview.rst	Tue Apr 06 16:02:08 2010 +0300
@@ -58,7 +58,7 @@
 After that you can simply call this function as an entry point to your program::
 
   if __name__ == '__main__':
-      main(argv=sys.argv[1:])
+      main()
 
 This will run command line parsing facility, using arguments from
 ``sys.argv``. ``%name`` in usage string will be replaced with ``sys.argv[0]``
--- a/opster.py	Tue Apr 06 15:57:48 2010 +0300
+++ b/opster.py	Tue Apr 06 16:02:08 2010 +0300
@@ -66,7 +66,7 @@
             except StopIteration:
                 options_.append(('h', 'help', False, 'show help'))
 
-            argv = opts.pop('argv', None)
+            argv = opts.pop('argv', sys.argv[1:])
             if opts.pop('help', False):
                 return help_func()
 
--- a/tests/test2	Tue Apr 06 15:57:48 2010 +0300
+++ b/tests/test2	Tue Apr 06 16:02:08 2010 +0300
@@ -16,5 +16,5 @@
     a = 42
 
 if __name__ == '__main__':
-    main(argv=[])
+    main()
     assert a == 42, "WTF???"
--- a/tests/test_opts.py	Tue Apr 06 15:57:48 2010 +0300
+++ b/tests/test_opts.py	Tue Apr 06 16:02:08 2010 +0300
@@ -31,5 +31,5 @@
     print locals()
 
 if __name__ == '__main__':
-    #main(argv=sys.argv[1:])
-    another(argv=sys.argv[1:])
+    #main()
+    another()