代码之家  ›  专栏  ›  技术社区  ›  Simeon Leyzerzon mthmulders

在Mac上通过命令行打开多个STS实例?

  •  0
  • Simeon Leyzerzon mthmulders  · 技术社区  · 7 年前

    我正在尝试让多个版本的STS通过命令行args从它们自己的工作区开始,并尝试 this 作为参考。

    结果是:

    $open -a ~/Applications/STS.app --args -clean
    FSPathMakeRef(/Users/xxx/Applications/STS.app) failed with error -43.
    

    STS的可执行文件在哪里?

    MacOS High Sierra v.10.13.6

    据我所知,STS最初是作为 spring-tool-suite-3.9.3.RELEASE-e4.7.3-macosx-cocoa-x86_64.dmg 这样安装的。

    我读到,在Mac上,你可以右键点击.app和“显示软件包内容”,我试过:

    enter image description here

    但是,从命令行访问它仍然不起作用:

    $ls -la ~/Applications/STS.app/Contents
    ls: /Users/simeonleyzerzon/Applications/STS.app/Contents: No such file or directory
    

    根据@greg-449的评论,我现在尝试打开STS并将其指向另一个工作区位置:

    $ open -a /Applications/STS.app -data /temp
    open: invalid option -- d
    Usage: open [-e] [-t] [-f] [-W] [-R] [-n] [-g] [-h] [-s <partial SDK name>][-b <bundle identifier>] [-a <application>] [filenames] [--args arguments]
    Help: Open opens files from a shell.
          By default, opens each file using the default application for that file.
          If the file is in the form of a URL, the file will be opened as a URL.
    Options:
          -a                Opens with the specified application.
          -b                Opens with the specified application bundle identifier.
          -e                Opens with TextEdit.
          -t                Opens with default text editor.
          -f                Reads input from standard input and opens with TextEdit.
          -F  --fresh       Launches the app fresh, that is, without restoring windows. Saved persistent state is lost, excluding Untitled documents.
          -R, --reveal      Selects in the Finder instead of opening.
          -W, --wait-apps   Blocks until the used applications are closed (even if they were already running).
              --args        All remaining arguments are passed in argv to the application's main() function instead of opened.
          -n, --new         Open a new instance of the application even if one is already running.
          -j, --hide        Launches the app hidden.
          -g, --background  Does not bring the application to the foreground.
          -h, --header      Searches header file locations for headers matching the given filenames, and opens them.
          -s                For -h, the SDK to use; if supplied, only SDKs whose names contain the argument value are searched.
                            Otherwise the highest versioned SDK in each platform is used.
    
    1 回复  |  直到 7 年前
        1
  •  1
  •   greg-449    7 年前

    应用程序是 /Applications ~ .

    ls -la /Applications/STS.app/Contents
    

    为了你的 open 您缺少命令 --args 告诉open命令行其余部分的选项用于应用程序:

    open -a /Applications/STS.app --args -data /temp
    
    推荐文章