# Command line option update

**URL:** <https://forum.ansible.com/t/command-line-option-update/11317>\
**Category:** Ansible Project\
**Created:** [March 2, 2012, 2:26am UTC](https://forum.ansible.com/t/command-line-option-update/11317 "2012-03-02T02:26:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [March 2, 2012, 2:26am UTC](https://forum.ansible.com/t/command-line-option-update/11317/1 "2012-03-02T02:26:45Z")

</div>

Ok, so I ended up compromising between Seth’s plan and mine.

The option name is still -p, but I’ve renamed the long form --host-pattern. -h is taken by opt parse for --help

The inventory file is now -i

-p options can be separated by semicolons and can be either host patterns (matching any host in the inventory file) or group names from the inventory file

I didn’t allow targeting hosts not in the file, because I believe this results in a confusing scenario if you typo a pattern or a group name, and it’s not readily apparent  
nothing is matched.

I’ve updated the README and docs to reflect this.

It also seems we can eliminate “-a” if we use the unmatched args, so I’m working to incorporate that from Seth’s earlier patches. I also think defaulting -n to command is pretty elegant.

It bothers me that the default pattern is “\*”, as that seems a thermonuclear option. So I am going to REQUIRE a value be supplied for -p. No default.

AKA:

ansible rm -rf /srv

VS

ansible -p “webservers” rm -rf /srv

In the latter, you made a conscious decision about what you were going to target. That walks a bit of a line between being crazy useful and very easy to shoot your foot off with.

–Michael

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [March 2, 2012, 2:38am UTC](https://forum.ansible.com/t/command-line-option-update/11317/2 "2012-03-02T02:38:47Z")

</div>

Actually this seems cleanest, because it uses arguments to be required. Required options is kind of an oxymoron anyway.

ansible [-n foo] [-a foo]

The command module will also be modified to fail with proper JSON if it receives no arguments.

Also, while I _COULD_ also make arguments work outside of -a, I’d rather keep things explicit.

I am also renaming “-n” to “-m” since I think “module” better than I think “name”. Stay tuned, and check README.md tomorrow I guess 🙂

CLI design is a path to madness.

–Michael
