Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-16 Thread Mats Wichmann
On 10/15/20 5:09 PM, Samuel Marks wrote: > Yes it’s my module, and I’ve been using argparse > https://github.com/SamuelMarks/ml-params > > No library I’ve found provides a solution to CLI argument parsing for my > use-case. > > So I’ll write one. But what should it look like, syntactically and >

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-16 Thread Samuel Marks
Yeah, but the risk with config files is you need a website—and/or full JSON schema output—to figure out what’s needed. (Although I should mention that with my doctrans project you can generate a config class—and class method—from/to your argparse parser; enabling the config file scenario rather cl

Re: Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Samuel Marks
Yeah I've played with custom actions before https://github.com/offscale/argparse-utils/tree/master/argparse_utils/actions But this would only help in one phase, the important phase of providing help text will need to be provided out-of-argparse and thrown in (like my trivial absl alternative, exp

Re: Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Dieter Maurer
Samuel Marks wrote at 2020-10-16 10:09 +1100: >Yes it’s my module, and I’ve been using argparse >https://github.com/SamuelMarks/ml-params > >No library I’ve found provides a solution to CLI argument parsing for my >use-case. Do you know that with `argparse` you can specify how many arguments an op

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread 2QdxY4RzWzUUiLuE
On 2020-10-16 at 11:27:56 +1100, Regarding "Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?," Samuel Marks wrote: > The feature that existing CLI parsers are missing is a clean syntax > for specifying options on the second param

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Cameron Simpson
On 16Oct2020 10:59, Samuel Marks wrote: >--optimizer Adam,learning_rate=0.01,something_else=3 > >That syntax isn’t so bad! =] > >How would you suggest the help text for this looks? (don’t worry about >implementation, just what goes to stdout/stderr) Maybe: Usage: ... ..

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Samuel Marks
Hi Dan, The feature that existing CLI parsers are missing is a clean syntax for specifying options on the second parameter (the "value"), where there may be different options available depending on which you choose. For example: https://www.tensorflow.org/api_docs/python/tf/keras/optimizers/Adam

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread 2QdxY4RzWzUUiLuE
On 2020-10-16 at 10:20:40 +1100, Cameron Simpson wrote: > On 16Oct2020 10:09, Samuel Marks wrote: > >Yes it’s my module, and I’ve been using argparse > >https://github.com/SamuelMarks/ml-params > > > >No library I’ve found provides a solution to CLI argument parsing for my > >use-case. Out of c

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread 2QdxY4RzWzUUiLuE
On 2020-10-16 at 10:59:16 +1100, Samuel Marks wrote: > --optimizer Adam,learning_rate=0.01,something_else=3 > > That syntax isn’t so bad! =] > > How would you suggest the help text for this looks? (don’t worry about > implementation, just what goes to stdout/stderr) --optimizer name[,optio

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Karen Shaeffer via Python-list
Hi Sam, I’ve been using abseil python API. https://abseil.io/docs/python/guides/flags https://abseil.io/docs/python/quickstart It’s a distributed command line system with features that appear to support you

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Samuel Marks
--optimizer Adam,learning_rate=0.01,something_else=3 That syntax isn’t so bad! =] How would you suggest the help text for this looks? (don’t worry about implementation, just what goes to stdout/stderr) PS: Yeah I used square brackets for my Bash arrays On Fri, 16 Oct 2020 at 10:26 am, Cameron S

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Cameron Simpson
One other thing: On 15Oct2020 20:53, Samuel Marks wrote: >Idea: preprocess `sys.argv` so that this syntax would work >`--optimizer Adam[learning_rate=0.01]`* > >*square rather than round so as not to require escape characters or >quoting in `sh` Square brackets are also shell syntax, introducing

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Cameron Simpson
On 16Oct2020 10:09, Samuel Marks wrote: >Yes it’s my module, and I’ve been using argparse >https://github.com/SamuelMarks/ml-params > >No library I’ve found provides a solution to CLI argument parsing for my >use-case. > >So I’ll write one. But what should it look like, syntactically and >semantic

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Samuel Marks
Yes it’s my module, and I’ve been using argparse https://github.com/SamuelMarks/ml-params No library I’ve found provides a solution to CLI argument parsing for my use-case. So I’ll write one. But what should it look like, syntactically and semantically? On Fri, 16 Oct 2020 at 3:14 am, Dieter Mau

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Dieter Maurer
Samuel Marks wrote at 2020-10-15 20:53 +1100: > ... >To illustrate the issue, using `ml-params` and ml-params-tensorflow: > ... >What's the right solution here? While Python provides several modules in its standard library to process parameters (e.g. the simple `getopt` and the flexible `argparse`

Re: CLI Arguments That Call Functions?

2015-06-18 Thread Michael Torrie
On 06/18/2015 12:08 PM, Tony the Tiger wrote: > Forgot to add, I don't read or see anything posted from outside of the > groups. Posting from the mailing list here. I assume the nntp gateway is two-way. Unless you're manually blocking message originating in google groups, I don't see why you w

Re: CLI Arguments That Call Functions?

2015-06-18 Thread Ian Kelly
On Thu, Jun 18, 2015 at 11:56 AM, Tony the Tiger wrote: > I would have assumed there would be something built in to the > ArgumentParser, but I can't detect anything that seems to do what I want, > so I wrote the following: [SNIP] > So, is there something already in the Python libs? Do I continu

Re: CLI framework using python

2014-10-15 Thread vijnaana bhairava
Hi Naoki, I am new to python programming. Getting used to writing basic scripts to understand python. To understand 'Click' i may need some more guidance. For e.g if i were to do 'ifconfig -a' from Click, how would the program look like. That will help me get started. What i am looking for is

Re: CLI framework using python

2014-10-14 Thread Naoki INADA
Click_ is another CLI framework. It support multi-level nested command like git and it has some nice utilities. I love it's design. .. _click: http://click.pocoo.org/3/ — Sent from Mailbox On Tue, Oct 14, 2014 at 10:35 PM, vijnaana bhairava wrote: > Hi Folks, > The requirement is to

Re: CLI framework using python

2014-10-14 Thread Chris Angelico
On Wed, Oct 15, 2014 at 12:33 AM, vijnaana bhairava wrote: > Another question i have is whether it uses argparse? > If so, what value add does PYCLI do? It depends what you mean by "CLI framework". If you simply mean something like hg, where you have subcommands and options and so on, all you rea

Re: CLI framework using python

2014-10-14 Thread vijnaana bhairava
Hi Folks, The requirement is to develop a CLI framework in python for a linux router. The suggestions i got is to use PyCli/Cliff. Not sure which would be the right choice! Also, a few APIs are mentioned here: https://pythonhosted.org/pyCLI/#module-cli.app Since i couldn't find any actual imp

Re: CLI framework using python

2014-10-10 Thread Gelonida N
On 10/10/2014 10:43 AM, Rustom Mody wrote: On Thursday, October 9, 2014 9:31:39 PM UTC+5:30, gelonida wrote: For calling commands in a slightly nicer way than os.system / sybprocess.Popen you might look at sh or plumbum https://pypi.python.org/pypi/sh https://pypi.python.org/pypi/plumbum

Re: CLI framework using python

2014-10-10 Thread Jean-Michel Pichavant
- Original Message - > From: [email protected] > > Hi, > > I need to develop a python CLI framework. > [snip] > 3. There are other such commands for which i will be using python > scripts. I came across pyCLI, but it doesn't have much > documentation, so couldn't figure out how to move

Re: CLI framework using python

2014-10-10 Thread Rustom Mody
On Thursday, October 9, 2014 9:31:39 PM UTC+5:30, gelonida wrote: > For calling commands in a slightly nicer way than os.system / > sybprocess.Popen you might look at sh or plumbum > https://pypi.python.org/pypi/sh > https://pypi.python.org/pypi/plumbum Both of these look quite nice! [Im looki

Re: CLI framework using python

2014-10-09 Thread Python UL
On 09-10-14 14:20, [email protected] wrote: Hi, I need to develop a python CLI framework. For example if i need to set an ip address in linux: ifconfig eth0 172.16.25.125 I should be able to use python to do the above. 1. The user will execute a python script to which i will pass the param

Re: CLI framework using python

2014-10-09 Thread Gelonida N
On 10/09/2014 05:25 PM, Unix SA wrote: Hello, Go for Optparse.. Look at below docs on how to use it. http://pymotw.com/2/optparse/ For newer projects I'd suggest argparse (part of Python since 2.7 and can be downloaded / installed for 2.5 / 2.6). https://docs.python.org/2.7/library/argpar

Re: CLI framework using python

2014-10-09 Thread Unix SA
Hello, Go for Optparse.. Look at below docs on how to use it. http://pymotw.com/2/optparse/ Regards, DJ On Thu, Oct 9, 2014 at 5:50 PM, wrote: > Hi, > > I need to develop a python CLI framework. > > For example if i need to set an ip address in linux: > > ifconfig eth0 172.16.25.125 > > I sho

Re: cli user interface ala cisco IOS or JUNOS

2007-04-03 Thread phil . aerts . tln
On 3 apr, 11:57, Ben Finney <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] writes: > > for one of mypythonprojects I need an user interface similar to that > > of cisco IOS or even better JuniperJUNOS. > > Does anyone know of existingpythonmodules that gives this kind of > > functionality? > > I su

Re: cli user interface ala cisco IOS or JUNOS

2007-04-03 Thread Ben Finney
[EMAIL PROTECTED] writes: > for one of my python projects I need an user interface similar to that > of cisco IOS or even better Juniper JUNOS. > Does anyone know of existing python modules that gives this kind of > functionality? I suspect you've not checked the standard library index: Pyth

Re: CLI

2006-02-09 Thread Carl Cerecke
mwt wrote: > I want to do programmatic terminal commands on unix with python - i.e. > I want my program to issue commands to start and stop scripts, other > programs, etc. I'm sure this must be fairly straightforward, but > haven't been able to find a reference for it. Any help? > Try: pexpect.s

Re: CLI

2006-02-09 Thread Rene Pijlman
mwt: >I want to do programmatic terminal commands on unix with python - i.e. >I want my program to issue commands to start and stop scripts, other >programs, etc. I'm sure this must be fairly straightforward, but >haven't been able to find a reference for it. Any help? http://www.python.org/doc/2.

Re: CLI

2006-02-09 Thread Sybren Stuvel
mwt enlightened us with: > I want to do programmatic terminal commands on unix with python If you want to use a real terminal, search for pty. If you just want to start and stop scripts, check the popen2 module. Sybren -- The problem with the world is stupidity. Not saying there should be a cap