glad to be helpful and give my 2 cents to this community. your helptext is definetely acceptable, in the long run maybe a comment in the code will be more helpful than the "explicit" helpstring of optparse
Niphlod On Dec 30, 11:06 pm, Jonathan Lundell <jlund...@pobox.com> wrote: > On Dec 30, 2010, at 12:51 PM, Niphlod wrote: > > > > > uhm.... > > virtually very very very draft of Jonathan's concept..... > > That looks about right, perhaps with some minor wording changes: > > help='exit after saving password' (no sense in confusing the user > about file names, and there's really no other initialization involved) > > print 'no password to save; exiting' > > (remove the "Creating..." print) > print 'password saved; exiting' > > > > > in gluon/widget.py , after "if '-A' in sys.argv: k = sys.argv.index('- > > A')" (line 695, in trunk), add: > > > parser.add_option('', > > '--exit', > > action='store_true', > > dest='force_exit', > > default=False, > > help='allows to save parameters.py file in order > > to initialize the environment' > > ) > > > then, before " if options.quiet:" (line 704, in trunk): > > > if options.force_exit and options.password == '<ask>': > > options.password = raw_input('choose a password:') > > if not options.password: > > print 'no password, --exit specified, clean shutdown' > > sys.exit(0) > > if options.force_exit and options.password: > > print 'Creating parameters.py file' > > main.save_password(options.password, options.port) > > print 'parameters.py created, now exiting' > > sys.exit(0) > > > tested and working.... > > > eg: you can call > >> web2py.py -a yourpass --exit > >> web2py.py -a '<recycle>' > > > and everything works. > > > Make sure you start the webserver with the same port (default 8000, > > can be overridden with -p) > > > Humbly helping ^_^ > > > Happy new year, if we'll not see within the next days.... > >