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

Command line argument documentation and a '--help' option #6484

Closed
Lindenk opened this issue May 18, 2016 · 19 comments
Closed

Command line argument documentation and a '--help' option #6484

Lindenk opened this issue May 18, 2016 · 19 comments
Assignees
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)

Comments

@Lindenk
Copy link

Lindenk commented May 18, 2016

Hello!

Visual Studio Code seems to accept command line arguments for some things, such as disabling extentions and openning to a given path, however they do not seem to be documented anywhere (that I can easily find at least). I'm sure many other users have run into the problem of wanting to know what vscode supports when opened from a terminal and the first thing most of them will try is passing the --help option to vscode.

So, my feature request is for a standard help/usage message to be displayed when giving the --help option to vscode.

@Tyriar
Copy link
Member

Tyriar commented May 18, 2016

This was added a few versions ago:

Visual Studio Code v1.1.0

Usage: code [arguments] [paths...]

Options:
  -d, --diff            Open a diff editor. Requires to pass two file paths
                        as arguments.
  --disable-extensions  Disable all installed extensions.
  -g, --goto            Open the file at path at the line and column (add
                        :line[:column] to path).
  -h, --help            Print usage.
  --locale <locale>     The locale to use (e.g. en-US or zh-TW).
  -n, --new-window      Force a new instance of Code.
  -r, --reuse-window    Force opening a file or folder in the last active
                        window.
  --user-data-dir <dir> Specifies the directory that user data is kept in,
                        useful when running as root.
  -v, --version         Print version.
  -w, --wait            Wait for the window to be closed before returning.
  --list-extensions     List the installed extensions.
  --install-extension <extension>
                        Installs an extension.
  --uninstall-extension <extension>
                        Uninstalls an extension.

Can you provide OS and if on Linux/OSX run whereis code and provide the output?

@Tyriar Tyriar added the *question Issue represents a question, should be posted to StackOverflow (VS Code) label May 18, 2016
@Tyriar Tyriar self-assigned this May 18, 2016
@Tyriar
Copy link
Member

Tyriar commented May 18, 2016

@Tyriar Tyriar added the info-needed Issue requires more information from poster label May 18, 2016
@Lindenk
Copy link
Author

Lindenk commented May 18, 2016

Hmm, maybe it's just a bug then.

I'm using Arch Linux x86_64 using the AUR package for visual-studio-code. The output of whereis visual-studio-code (which is the name it was installed as) gives:
visual-studio-code: /usr/bin/visual-studio-code

EDIT: whereis code gives code: /opt/visual-studio-code/bin/code although code is not in my $PATH.

After trying most of the above options, it looks like none of them are writing to stdout or stderr, --version and --help open vscode as if no options were given, and by default, vscode does not return immediately as I would expect should happen without the -w option. diff, -r, and -n seem to work as expected.

Here is the about information given from Help -> About in vscode:
Version 1.1.1
Commit def9e32
Date 2016-05-13T13:38:00.094Z
Shell 0.37.6
Renderer 49.0.2623.75
Node 5.10.0

@Tyriar
Copy link
Member

Tyriar commented May 18, 2016

The problem is likely because you're using an unofficial package that's not configured correctly. I'm guessing /usr/bin/visual-studio-code points at <path>/code instead of <path>/bin/code, that's likely how you fix it.

Some command line options will work, some that are evaluated before electron is touched (like --help, --version) however won't.

@Lindenk
Copy link
Author

Lindenk commented May 18, 2016

Ah, that seems to work. Thanks! I'll fix the AUR package for it as well.

@Tyriar
Copy link
Member

Tyriar commented May 18, 2016

@Lindenk cheers. Is there something I could do to help improve the quality of the package? I'm not too familiar with Arch Linux/AUR.

@Tyriar Tyriar closed this as completed May 18, 2016
@Tyriar Tyriar removed the info-needed Issue requires more information from poster label May 18, 2016
@Lindenk
Copy link
Author

Lindenk commented May 18, 2016

It looks like it was just a bug in the install script for the package, but thanks for the offer. The AUR is essentially just a community repository of build scripts for software that isn't in the offical repository, so, as long as the script builds the package correctly and has the correct dependancies, it should work as expected.

@Tyriar
Copy link
Member

Tyriar commented May 18, 2016

@Lindenk the problem is if it's building from the vscode repository, it won't build vscode in full as there's a small portion of the configuration that's closed. Would the AUR package be able to leverage a properly packaged .tar.gz file? If so in what format should it be?

@Tyriar
Copy link
Member

Tyriar commented May 18, 2016

@Lindenk I'd love for installs on Arch Linux to be just as easy as deb/rpms are via the website.

@Tyriar
Copy link
Member

Tyriar commented May 18, 2016

@Lindenk I created #6495, if you could provide any insight on that issue it would be helpful :)

@Lindenk
Copy link
Author

Lindenk commented May 18, 2016

The build script for the package downloads the binary from here which seems to be the official build. Then it's extracted, installed and symlinked it to the (hopefully) correct locations. The script itself is managed by the community and is generally the standard for non-official Arch Linux packages. If you'd like to skim the script it's available here, but, other than the package getting a large amount of community support and being taken on by an official Arch Linux maintainer, I think keeping it as a package on the AUR is the most convenient way to provide vscode to the Arch Linux community.

@Tyriar
Copy link
Member

Tyriar commented May 18, 2016

@Lindenk ok using VSCode-linux-x64-stable.zip should be relatively safe, you're just missing out on the post/pre install stuff in the deb/rpms files (mainly just the symlink at this point):

We're totally open to contributions if a .tar.gz that contained some install script would be better for example.

@Tyriar
Copy link
Member

Tyriar commented May 18, 2016

To clarify: the community packages are awesome, I just want to make sure the heavy lifting is done on our build system so things like this issue are avoided in the future 😃

@Lindenk
Copy link
Author

Lindenk commented May 18, 2016

Well, thanks for the help and interest! Usually these kinds of problems are pretty rare, but ultimately I would expect an install script to be difficult to maintain on your end in case something Arch Linux related causes breaking changes. I'll post a link to the other issue in the IRC in case anyone else in the community has some better input on the subject.

@xparq
Copy link

xparq commented Mar 21, 2017

Hello! (Google dropped me here, but since this one is "Closed", I tried finding a similar open one from the GitHub issue finder, but gave up after wading through a few dozen irrelevant ones, except for #15435. Since I have the exact same problem as the title of this one here, I eventually chose this, sorry if it causes any trouble.)

v1.10.2, Win7(32-bit) here, everything's vanilla, AFAIK:
image
Extensions: Code Runner 0.6.14, PHP Debug 1.10.0, Remote VSCode 1.0.1 -- disabling them didn't help (see below).

code.exe --help just launches the editor, ignoring the option (-h, /h /? and all other desperate variants as well; code --version seems to be ignored, too).

code.exe --disable-extensions OTOH (which I tried following a hint from @Tyriar above) does seem to work. Opening files from the command line works, too.

Then I even tried code.exe --disable-extensions --help, but nope.

(Please note: I'm just a user, I have no idea what "electron" is, and I like it that way. ;) Thanks, cheers!)

@Tyriar
Copy link
Member

Tyriar commented Mar 21, 2017

@lunakid I believe you need to run code.cmd (aka code) to get the real command line interface, code.exe is the Electron executable that will launch the app.

@xparq
Copy link

xparq commented Mar 25, 2017

Ah, damn, indeed, thank you very much! (Still have no idea what "Electron" is, though. ;) )

@Tyriar
Copy link
Member

Tyriar commented Mar 26, 2017

@lunakid just the way you like it 😉

@xparq
Copy link

xparq commented Oct 14, 2017

Yeah, but that didn't help what I didn't like. ;)

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)
Projects
None yet
Development

No branches or pull requests

3 participants