Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Command line args would have been the simplest solution imho. Works simple for simple cases and power users will create a bash wrapper anyway.

Hard to be wise without knowing the context, but I avoid config files as much as possible, because:

- Where does the config file live on different machines?

- What if I want to have 2 configurations on one machine?

- What if I need to change the list dynamically?

`for ip in sys.args` would give you most flexibility.



I agree but I wanted to avoid this:

... writing 34 IP addresses as CLI parameter, that is around 373 letters, is not a nice solution.


A bash script where you call the CLI program once for each IP would be a very simple solution.

    ./script 127.0.0.1 5
    ./script 127.0.0.2 5
    . . .
    ./script 127.0.1.254 10


I was on windows. But OK, there is batch script also.

I had to call program will all IP addresses, one by one would just not work.

Your idea is fine, but it was just acceptable in my use case.


You can write multiple arguments in a nice way:

  ./script \
    192.168.1.1 \
    192.168.1.2 \
    192.168.1.3 \
    ...


valid argument :-), accepted




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: