# Make launcher forgive swapped parameters

**URL:** https://meta.discourse.org/t/make-launcher-forgive-swapped-parameters/54873
**Category:** Feature
**Created:** [12월 28, 2016, 12:11오후 UTC](https://meta.discourse.org/t/make-launcher-forgive-swapped-parameters/54873 "2016-12-28T12:11:02Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![claas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/claas/32/71725_2.png) [@claas](https://meta.discourse.org/u/claas)
#### Post date: [12월 28, 2016, 12:11오후 UTC](https://meta.discourse.org/t/make-launcher-forgive-swapped-parameters/54873/1 "2016-12-28T12:11:02Z")

</div>

Even though I’m using the Discourse Docker setup for almost half a year now, it still happens to me that I swap the `launcher` parameters and I write

```
./launcher app enter

```

instead of

```
./launcher enter app

```

To make a long story short and end this frustration, I suggest making the launcher forgive swapped parameters…

---

<div class="post-metadata">

### Author: ![claas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/claas/32/71725_2.png) [@claas](https://meta.discourse.org/u/claas)
#### Post date: [12월 28, 2016, 12:12오후 UTC](https://meta.discourse.org/t/make-launcher-forgive-swapped-parameters/54873/2 "2016-12-28T12:12:30Z")

</div>

…and provide a PR for this:

[https://github.com/discourse/discourse\_docker/pull/321](https://github.com/discourse/discourse_docker/pull/321)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [12월 28, 2016, 5:25오후 UTC](https://meta.discourse.org/t/make-launcher-forgive-swapped-parameters/54873/3 "2016-12-28T17:25:48Z")

</div>

This is a little weird it basically means all launcher commands are now disallowed as container names? Not that matching names isn’t confusing anyway, I grant you that…

---

<div class="post-metadata">

### Author: ![claas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/claas/32/71725_2.png) [@claas](https://meta.discourse.org/u/claas)
#### Post date: [12월 28, 2016, 5:47오후 UTC](https://meta.discourse.org/t/make-launcher-forgive-swapped-parameters/54873/4 "2016-12-28T17:47:18Z")

</div>

> [@codinghorror](#):
>
> This is a little weird it basically means all launcher commands are now disallowed as container names?

No, I don’t see why this would mean that launcher command names are disallowed as container names: If the first parameter is a valid command, behavior will be the same as it is now. And if the first parameter is not a valid command, the current behavior is to `exit 1` with an error message.

My PR only addresses the case where the first command is _not_ a valid command name _and_ the second command is a valid command name. In this case, it is probable that the user confused the parameter order.

For the sake of safety, we could prompt the user:

```plaintext
$ launcher app build
'app' is not a valid command name.
Did you mean 'launcher build app'? [Y/n]

```

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [12월 28, 2016, 5:51오후 UTC](https://meta.discourse.org/t/make-launcher-forgive-swapped-parameters/54873/5 "2016-12-28T17:51:25Z")

</div>

Yes I like that much better! If you can make that change I vote we accept your PR.

---

<div class="post-metadata">

### Author: ![claas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/claas/32/71725_2.png) [@claas](https://meta.discourse.org/u/claas)
#### Post date: [12월 28, 2016, 6:06오후 UTC](https://meta.discourse.org/t/make-launcher-forgive-swapped-parameters/54873/6 "2016-12-28T18:06:06Z")

</div>

There you go:

> <https://github.com/discourse/discourse_docker/pull/321/commits/601fded2dd5f44e89ab686e2c93b27a1982a9eaf>

PS: Interesting: The first line (_[GitHub - discourse/discourse\_docker: A Docker image for Discourse · GitHub](http://github.com/discourse/discourse_docker)_) links to the commit (= url that i posted here), whereas the subject line (_FEATURE: Make launcher forgive swapped parameters_) links to the PR. I’m sure that’s intended, but that just surprised me.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [12월 28, 2016, 6:14오후 UTC](https://meta.discourse.org/t/make-launcher-forgive-swapped-parameters/54873/7 "2016-12-28T18:14:03Z")

</div>

Ok can you review that @falco?

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [12월 28, 2016, 11:37오후 UTC](https://meta.discourse.org/t/make-launcher-forgive-swapped-parameters/54873/8 "2016-12-28T23:37:12Z")

</div>

Nothing against making things more user friendly, but most of the few CLIs I’ve used simply output a type of `> enter --help` when I’ve used the wrong syntax.

---

<div class="post-metadata">

### Author: ![claas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/claas/32/71725_2.png) [@claas](https://meta.discourse.org/u/claas)
#### Post date: [12월 30, 2016, 11:24오전 UTC](https://meta.discourse.org/t/make-launcher-forgive-swapped-parameters/54873/9 "2016-12-30T11:24:56Z")

</div>

“Nothing against” and “but” don’t work well together, so let me say this: Most of the few forum softwares I’ve used weren’t very usable, so why making Discourse a usable forum software?

The answer is: because we can do better.

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [12월 30, 2016, 5:36오후 UTC](https://meta.discourse.org/t/make-launcher-forgive-swapped-parameters/54873/10 "2016-12-30T17:36:03Z")

</div>

> [@claas](#):
>
> “Nothing against” and “but” don’t work well together

I don’t know what you mean by that other than you must have misinterpreted what I meant it to say.

I did not mean that the code should not correct user error.  
Simply that most CLIs detect user error and “point them in the right direction” instead of trying to correct it for them.

If it is easy enough to accept command arguments and options in different sequences, different grammar (eg. `./launcher -r -a`), then yes, it should be done.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [10월 2, 2019, 5:23오전 UTC](https://meta.discourse.org/t/make-launcher-forgive-swapped-parameters/54873/11 "2019-10-02T05:23:13Z")

</div>

> [@codinghorror](#):
>
> 네, 그쪽이 훨씬 좋습니다! 그 변경 사항을 적용할 수 있다면, 저는 PR 수락에 찬성합니다.

죄송합니다. 이 PR을 3년 동안 방치해 두었네요… 그리고 3년 만에 이를 거절하게 되었습니다.

거절하는 이유는 다음과 같습니다. 우리의 거대한 bash 코드는 이미 매우 취약하고 복잡하기 때문에, 여기에 새로운 것을 추가하는 것에 대해 매우 신중해야 합니다. 이는 우리가 신경 써야 할 또 다른 취약점이 되며, 명령을 추가할 때마다 이 부분을 업데이트해야 합니다.
