Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SvelteKit cli overlapping parameter shortcut -h #1432

Closed
Kage0x3B opened this issue May 12, 2021 · 5 comments · Fixed by #3573
Closed

SvelteKit cli overlapping parameter shortcut -h #1432

Kage0x3B opened this issue May 12, 2021 · 5 comments · Fixed by #3573
Labels
blocked by upstream bug Something isn't working p3-edge-case SvelteKit cannot be used in an uncommon way

Comments

@Kage0x3B
Copy link

Describe the bug
The "svelte-kit" cli commands dev, preview and start have overlapping parameter shortcuts for the host parameter and the help, both shortcuts are -h. When using the shortcut, the help is always displayed and the command exits.
(Using --host instead works)

Logs

$ npx svelte-kit dev -ho

  Description
    Deprecated — use svelte-kit preview instead

  Usage
    $ svelte-kit start [options]

  Options
    -p, --port     Port  (default 3000)
    -h, --host     Host (only use this on trusted networks)  (default localhost)
    -H, --https    Use self-signed HTTPS certificate  (default false)
    -o, --open     Open a browser tab  (default false)
    -h, --help     Displays this message

To Reproduce

  • Execute the dev command npx svelte-kit dev -ho in any SvelteKit project.
  • It should then only show the help message.

Expected behavior
The development server starts, binds to 0.0.0.0 because of the -h parameter and launches the browser -o

Information about your SvelteKit Installation:

Diagnostics

System:
OS: Linux 5.4 Ubuntu 18.04.5 LTS (Bionic Beaver)
CPU: (8) x64 AMD FX(tm)-8350 Eight-Core Processor
Memory: 790.58 MB / 11.68 GB
Container: Yes
Shell: 5.4.2 - /usr/bin/zsh
Binaries:
Node: 14.16.1 - ~/.nvm/versions/node/v14.16.1/bin/node
npm: 6.14.12 - ~/.nvm/versions/node/v14.16.1/bin/npm
Browsers:
Firefox: 88.0.1
npmPackages:
@sveltejs/kit: next => 1.0.0-next.107
svelte: ^3.34.0 => 3.38.2
vite: ^2.2.4 => 2.3.1

Severity
Low, --host parameter can be used instead, just a small annoyance which might confuse users.

@Rich-Harris Rich-Harris added this to the 1.0 milestone May 12, 2021
@Rich-Harris Rich-Harris added the bug Something isn't working label May 12, 2021
@dberesford
Copy link

I had thought about simply removing the '-h' shortcut for '--help' as a proposed solution but when I look in to it, although the cmd line opts are set here:

.option('-p, --port', 'Port', 3000)

the -h --help is hard coded in the sade package:

https://github.com/lukeed/sade/blob/89f7377442a38fa90e51abf4f953e14af0f2f2cf/lib/utils.js#L44

@jthegedus
Copy link
Contributor

jthegedus commented May 19, 2021

This was introduced in #834

Given --host was implemented before --https my suggestion would be:

    -p, --port     Port  (default 3000)
-   -h, --host     Host (only use this on trusted networks)  (default localhost)
+   -H, --host     Host (only use this on trusted networks)  (default localhost)
-   -H, --https    Use self-signed HTTPS certificate  (default false)
+   -S, --https    Use self-signed HTTPS certificate  (default false)

    -o, --open     Open a browser tab  (default false)
    -h, --help     Displays this message

This aligns with Sade docs which has examples with -H, --host, which likely informs first-time users and thus it is likely -H is used with --host elsewhere.

Noteably, Vite doesn't have aliases for it's --host or --https options, likely because of this conflict.

@benmccann
Copy link
Member

I'm used to -h for host. E.g. that's what the mysql and psql command-line clients do. They use -? for help. I filed lukeed/sade#47 over in the sade repo

@benmccann benmccann removed this from the 1.0 milestone Jul 22, 2021
@bluwy bluwy added blocked by upstream p3-edge-case SvelteKit cannot be used in an uncommon way labels Jan 4, 2022
@Rich-Harris
Copy link
Member

I think -h for --help is pretty universal (see node -h, npm -h, etc). I like -H, --host and -S, https

@Rich-Harris
Copy link
Member

Then again, it's a tricky breaking change (if someone was already using -H for --https, we'd have no way of knowing that they meant -S and not --host.) Am wondering if we shouldn't just remove those shortcuts and make it less ambiguous

Rich-Harris added a commit that referenced this issue Jan 27, 2022
* remove -H and -h shortcuts from CLI - fixes #1432

* make the breaking change explicit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked by upstream bug Something isn't working p3-edge-case SvelteKit cannot be used in an uncommon way
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants