scj7t4/FREEDM — pull request #118 by Catanzaro (2012-12-22 17:39:43+00:00)
Title: Pretty up cli/config options

This obsoletes pull request #117

* --address and --port must now be specified if used on the cli
(i.e. they are no longer positional arguments)

* -g is now useful if a peer uses a different listening port.
You can use either -g hostname to assume his listening port is
the same as yours, as before, or now use -g hostname:port

* Fix --version to actually work

* --list-loggers is no longer valid in freedm.cfg, only on cli

* Help is now sent to stdout instead of stderr

* Remove setuuid option, which was broken and would be hard to fix

* Return 1 instead of -1 if the config file didn't load

-----

That's a big longer list of changes than I had yesterday.

To clarify what I've done to -g, before:

```
michael@suse-alto:~/freedm/Broker> ./PosixBroker -u
ea09c2df-de77-5b07-8c3a-493923026fe9
michael@suse-alto:~/freedm/Broker> ./PosixBroker --port 1871 -u
062e2f20-91bf-50b6-8bf4-04ea1428dace
michael@suse-alto:~/freedm/Broker> ./PosixBroker -g suse-alto
ea09c2df-de77-5b07-8c3a-493923026fe9
michael@suse-alto:~/freedm/Broker> ./PosixBroker -g suse-alto:1871
aa4650c6-756c-56b9-a824-e35ad2ffc6de
```

The last line is meaningless. Now:

```
michael@suse-alto:~/freedm/Broker> ./PosixBroker -u
ea09c2df-de77-5b07-8c3a-493923026fe9
michael@suse-alto:~/freedm/Broker> ./PosixBroker --port 1871 -u
062e2f20-91bf-50b6-8bf4-04ea1428dace
michael@suse-alto:~/freedm/Broker> ./PosixBroker -g suse-alto
ea09c2df-de77-5b07-8c3a-493923026fe9
michael@suse-alto:~/freedm/Broker> ./PosixBroker -g suse-alto:1871
062e2f20-91bf-50b6-8bf4-04ea1428dace
```

Oh cool.

And there is simple sanity-checking:

```
michael@suse-alto:~/freedm/Broker> ./PosixBroker -g suse-alto:1871b
Tried to generate a UUID using hostname=suse-alto, port=1871b, but this is silly.
michael@suse-alto:~/freedm/Broker> ./PosixBroker -g suse:al:to
Tried to generate a UUID using hostname=suse, port=al:to, but this is silly.
```

Hope that's better than the last pull request. :-)