Skip to content

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

Closed

Description

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.

Activity

  1. Tyriar commented on May 18, 2016

    @Tyriar
    Contributor

    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?

  2. added
    *question
    on May 18, 2016
  3. added
    info-needed
    on May 18, 2016
  4. Lindenk commented on May 18, 2016

    @Lindenk
    Author

    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

  5. Tyriar commented on May 18, 2016

    @Tyriar
    Contributor

    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.

  6. Lindenk commented on May 18, 2016

    @Lindenk
    Author

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

  7. Tyriar commented on May 18, 2016

    @Tyriar
    Contributor

    Linden Krouse (@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.

  8. removed
    info-needed
    on May 18, 2016
  9. Lindenk commented on May 18, 2016

    @Lindenk
    Author

    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.

  10. Tyriar commented on May 18, 2016

    @Tyriar
    Contributor

    Linden Krouse (@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?

  11. Tyriar commented on May 18, 2016

    @Tyriar
    Contributor

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

  12. Tyriar commented on May 18, 2016

    @Tyriar
    Contributor

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

  13. Lindenk commented on May 18, 2016

    @Lindenk
    Author

    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.

  14. Tyriar commented on May 18, 2016

    @Tyriar
    Contributor

    Linden Krouse (@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.

  15. Tyriar commented on May 18, 2016

    @Tyriar
    Contributor

    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 😃

  16. Lindenk commented on May 18, 2016

    @Lindenk
    Author

    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.

  17. xparq commented on Mar 21, 2017

    @xparq

    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 Daniel Imms (@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!)

  18. Tyriar commented on Mar 21, 2017

    @Tyriar
    Contributor

    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.

  19. xparq commented on Mar 25, 2017

    @xparq

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

  20. Tyriar commented on Mar 26, 2017

    @Tyriar
    Contributor

    lunakid just the way you like it 😉

  21. xparq commented on Oct 14, 2017

    @xparq

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

  22. locked and limited conversation to collaborators on Nov 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

*question

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions