当前位置: 首页>>代码示例>>Java>>正文


Java GeneralCommandLine类代码示例

本文整理汇总了Java中com.intellij.execution.configurations.GeneralCommandLine的典型用法代码示例。如果您正苦于以下问题:Java GeneralCommandLine类的具体用法?Java GeneralCommandLine怎么用?Java GeneralCommandLine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GeneralCommandLine类属于com.intellij.execution.configurations包,在下文中一共展示了GeneralCommandLine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: listDevices

import com.intellij.execution.configurations.GeneralCommandLine; //导入依赖的package包/类
@Test
    public void listDevices() {
        System.out.println(
                System.getProperty("user.home"));
//        System.getProperties().list(System.out);

        GeneralCommandLine commandLine = RNPathUtil.cmdToGeneralCommandLine(IOSDevicesParser.LIST_Simulator_JSON);

        try {
            String json = ExecUtil.execAndGetOutput(commandLine).getStdout();
            System.out.println("json=" + json);
            Simulators result = new Gson().fromJson(json, Simulators.class);
            System.out.println(result.devices.keySet());
            System.out.println(result.devices.get("iOS 10.3")[0]);
        } catch (ExecutionException e) {
            e.printStackTrace();
            NotificationUtils.errorNotification( "xcrun invocation failed. Please check that Xcode is installed." );
        }

    }
 
开发者ID:beansoftapp,项目名称:react-native-console,代码行数:21,代码来源:TestParseIOSDevices.java

示例2: parseCurrentPathFromRNConsoleJsonFile

import com.intellij.execution.configurations.GeneralCommandLine; //导入依赖的package包/类
@Test
    public void parseCurrentPathFromRNConsoleJsonFile() {
        //        System.out.println(
//                System.getProperty("user.home"));
//        System.getProperties().list(System.out);

        GeneralCommandLine commandLine = RNPathUtil.cmdToGeneralCommandLine(IOSDevicesParser.LIST_DEVICES);
        try {
            String json = ExecUtil.execAndGetOutput(commandLine).getStdout();
            System.out.println(json);
            Arrays.asList(json.split("\n")).forEach(line -> {
                System.out.println(line);
//                Pattern pattern = Pattern
//                        .compile("^([hH][tT]{2}[pP]://|[hH][tT]{2}[pP][sS]://)(([A-Za-z0-9-~]+).)+([A-Za-z0-9-~\\/])+$");
                boolean device = line.matches("^(.*?) \\((.*?)\\)\\ \\[(.*?)\\]");
                System.out.println("device=" + device);
//                String noSimulator = line.match(/(.*?) \((.*?)\) \[(.*?)\] \((.*?)\)/);
            });

        } catch (ExecutionException e) {
            e.printStackTrace();
            NotificationUtils.errorNotification( "xcrun invocation failed. Please check that Xcode is installed." );
            return;
        }
    }
 
开发者ID:beansoftapp,项目名称:react-native-console,代码行数:26,代码来源:TestParseIOSDevices.java

示例3: buildCommandLineParameters

import com.intellij.execution.configurations.GeneralCommandLine; //导入依赖的package包/类
@Override
protected void buildCommandLineParameters(GeneralCommandLine commandLine) {
  commandLine.setWorkDirectory(myTaskDir.getPath());
  ParamsGroup group = commandLine.getParametersList().getParamsGroup(GROUP_SCRIPT);
  assert group != null;

  Project project = myRunConfiguration.getProject();
  Course course = StudyTaskManager.getInstance(project).getCourse();
  assert course != null;

  group.addParameter(myRunConfiguration.getPathToTest());

  String path = getCurrentTaskFilePath();
  if (path != null) {
    group.addParameter(path);
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:18,代码来源:PyCCCommandLineState.java

示例4: run

import com.intellij.execution.configurations.GeneralCommandLine; //导入依赖的package包/类
public void run() throws Exception
{
    // Prepare and run node-command which will fetch settings.
    GeneralCommandLine commandLine = createCommandLine();
    Process process = commandLine.createProcess();

    String input = readInputStream(process.getInputStream());
    Gson gson = new GsonBuilder()
        .registerTypeAdapter(DefaultValue.class, new DefaultValueDeserializer())
        .create();

    Type targetType = new TypeToken<List<SettingTreeNode>>() {}.getType();
    List<SettingTreeNode> settings = gson.fromJson(input, targetType);

    if (settings == null)
    {
        String error = readInputStream(process.getErrorStream());
        String message = error.length() > 0 ? error : input;

        throw new Exception("Error occured while fetching completions: " + message);
    }

    SettingContainer completions = new SettingContainer(settings);
    CompletionPreloader.setCompletions(completions);
}
 
开发者ID:whitefire,项目名称:roc-completion,代码行数:26,代码来源:FetchCompletions.java

示例5: createCommandLine

import com.intellij.execution.configurations.GeneralCommandLine; //导入依赖的package包/类
private GeneralCommandLine createCommandLine() throws Exception
{
    GeneralCommandLine commandLine = new GeneralCommandLine();
    commandLine
        .withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.CONSOLE)
        .withCharset(StandardCharsets.UTF_8)
        .withWorkDirectory(project.getBasePath());

    NodeJsLocalInterpreter interpreter = NodeJsLocalInterpreterManager
        .getInstance()
        .detectMostRelevant();

    if (interpreter == null)
    {
        throw new Exception("Unable to create node-interpreter.");
    }
    // Move getSettings.js resource to .idea-folder within current project.
    ensureJsFile();

    commandLine.setExePath(interpreter.getInterpreterSystemDependentPath());
    commandLine.addParameter(getJsFilePath());
    commandLine.addParameter("roc-config");

    return commandLine;
}
 
开发者ID:whitefire,项目名称:roc-completion,代码行数:26,代码来源:FetchCompletions.java

示例6: setCommandLineParameters

import com.intellij.execution.configurations.GeneralCommandLine; //导入依赖的package包/类
@Override
public void setCommandLineParameters(@NotNull final GeneralCommandLine cmd,
                                             @NotNull final Project project,
                                             @NotNull final String filePath,
                                             @NotNull final String sdkPath,
                                             @NotNull final Task currentTask) {
  final List<UserTest> userTests = StudyTaskManager.getInstance(project).getUserTests(currentTask);
  if (!userTests.isEmpty()) {
    StudyLanguageManager manager = StudyUtils.getLanguageManager(currentTask.getLesson().getCourse());
    if (manager != null) {
      cmd.addParameter(new File(project.getBaseDir().getPath(), manager.getUserTester()).getPath());
      cmd.addParameter(sdkPath);
      cmd.addParameter(filePath);
    }
  }
  else {
    cmd.addParameter(filePath);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:PyStudyExecutor.java

示例7: generateCommandLine

import com.intellij.execution.configurations.GeneralCommandLine; //导入依赖的package包/类
protected GeneralCommandLine generateCommandLine() {
    GeneralCommandLine commandLine = new GeneralCommandLine();
    final LuaRunConfiguration cfg = (LuaRunConfiguration) runConfiguration;

    if (cfg.isOverrideSDKInterpreter()) {
        if (!StringUtil.isEmptyOrSpaces(cfg.getInterpreterPath()))
            commandLine.setExePath(cfg.getInterpreterPath());
    } else {
        final Sdk sdk = cfg.getSdk();

        if (sdk == null) {
            fillInterpreterCommandLine(commandLine);
        } else if (sdk.getSdkType() instanceof LuaSdkType) {
            String sdkHomePath = StringUtil.notNullize(sdk.getHomePath());
            String sdkInterpreter = getTopLevelExecutable(sdkHomePath).getAbsolutePath();
            commandLine.setExePath(sdkInterpreter);
        }
    }

    commandLine.getEnvironment().putAll(cfg.getEnvs());
    commandLine.setPassParentEnvironment(cfg.isPassParentEnvs());

    return configureCommandLine(commandLine);
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:25,代码来源:LuaCommandLineState.java

示例8: removeRepository

import com.intellij.execution.configurations.GeneralCommandLine; //导入依赖的package包/类
@Override
public void removeRepository(String repositoryUrl) {
  final String conda = PyCondaPackageService.getCondaExecutable();
  final ArrayList<String> parameters = Lists.newArrayList(conda, "config", "--remove", "channels", repositoryUrl, "--force");
  final GeneralCommandLine commandLine = new GeneralCommandLine(parameters);

  try {
    final Process process = commandLine.createProcess();
    final CapturingProcessHandler handler = new CapturingProcessHandler(process);
    final ProcessOutput result = handler.runProcess();
    final int exitCode = result.getExitCode();
    if (exitCode != 0) {
      final String message = StringUtil.isEmptyOrSpaces(result.getStdout()) && StringUtil.isEmptyOrSpaces(result.getStderr()) ?
                             "Permission denied" : "Non-zero exit code";
      LOG.warn("Failed to remove repository " + message);
    }
    PyCondaPackageService.getInstance().removeChannel(repositoryUrl);
  }
  catch (ExecutionException e) {
    LOG.warn("Failed to remove repository");
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:PyCondaManagementService.java

示例9: dumpPdbGuidsToFile

import com.intellij.execution.configurations.GeneralCommandLine; //导入依赖的package包/类
public int dumpPdbGuidsToFile(Collection<File> files, File output, BuildProgressLogger buildLogger) throws IOException {
  final GeneralCommandLine commandLine = new GeneralCommandLine();
  commandLine.setExePath(myExePath.getPath());
  commandLine.addParameter(DUMP_SYMBOL_SIGN_CMD);
  commandLine.addParameter(String.format("/o=%s", output.getPath()));
  commandLine.addParameter(String.format("/i=%s", dumpPathsToFile(files).getPath()));
  buildLogger.message(String.format("Running command %s", commandLine.getCommandLineString()));
  final ExecResult execResult = SimpleCommandLineProcessRunner.runCommand(commandLine, null);
  final String stdout = execResult.getStdout();
  if(!stdout.isEmpty()){
    buildLogger.message("Stdout: " + stdout);
  }
  final int exitCode = execResult.getExitCode();
  if (exitCode != 0) {
    buildLogger.warning(String.format("%s ends with non-zero exit code %s.", SYMBOLS_EXE, execResult));
    buildLogger.warning("Stdout: " + stdout);
    buildLogger.warning("Stderr: " + execResult.getStderr());
    final Throwable exception = execResult.getException();
    if(exception != null){
      buildLogger.exception(exception);
    }
  }
  return exitCode;
}
 
开发者ID:JetBrains,项目名称:teamcity-symbol-server,代码行数:25,代码来源:JetSymbolsExe.java

示例10: ShellCommand

import com.intellij.execution.configurations.GeneralCommandLine; //导入依赖的package包/类
public ShellCommand(@Nullable List<String> commandLine, @Nullable String dir, @Nullable Charset charset) {
  if (commandLine == null || commandLine.isEmpty()) {
    throw new IllegalArgumentException("commandLine is empty");
  }
  myCommandLine = new GeneralCommandLine(commandLine);
  if (dir != null) {
    myCommandLine.setWorkDirectory(new File(dir));
  }
  if (charset != null) {
    myCommandLine.setCharset(charset);
  }
  if (ApplicationManager.getApplication().isUnitTestMode()) {
    //ignore all hg config files except current repository config
    myCommandLine.getEnvironment().put("HGRCPATH", "");
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ShellCommand.java

示例11: executeProcess

import com.intellij.execution.configurations.GeneralCommandLine; //导入依赖的package包/类
public ConsoleProcessDescriptor executeProcess(final Module module,
                                               final GeneralCommandLine commandLine,
                                               @Nullable final Runnable onDone,
                                               boolean showConsole,
                                               final boolean closeOnDone,
                                               final String... input) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  assert module.getProject() == myProject;
  
  final MyProcessInConsole process = new MyProcessInConsole(module, commandLine, onDone, showConsole, closeOnDone, input);
  if (isExecuting()) {
    myProcessQueue.add(process);
  }
  else {
    executeProcessImpl(process, true);
  }
  return process;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:MvcConsole.java

示例12: doStartRemoteProcess

import com.intellij.execution.configurations.GeneralCommandLine; //导入依赖的package包/类
protected PyRemoteProcessHandlerBase doStartRemoteProcess(@NotNull Sdk sdk,
                                                          @NotNull final GeneralCommandLine commandLine,
                                                          @NotNull final PythonRemoteInterpreterManager manager,
                                                          @Nullable final Project project,
                                                          @Nullable PyRemotePathMapper pathMapper)
  throws ExecutionException {
  SdkAdditionalData data = sdk.getSdkAdditionalData();
  assert data instanceof PyRemoteSdkAdditionalDataBase;
  final PyRemoteSdkAdditionalDataBase pyRemoteSdkAdditionalDataBase = (PyRemoteSdkAdditionalDataBase)data;

  final PyRemotePathMapper extendedPathMapper = manager.setupMappings(project, pyRemoteSdkAdditionalDataBase, pathMapper);

  try {
    return PyRemoteProcessStarterManagerUtil
      .getManager(pyRemoteSdkAdditionalDataBase).startRemoteProcess(project, commandLine, manager, pyRemoteSdkAdditionalDataBase,
                                                   extendedPathMapper);
  }
  catch (InterruptedException e) {
    throw new ExecutionException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:PyRemoteProcessStarter.java

示例13: addArgs

import com.intellij.execution.configurations.GeneralCommandLine; //导入依赖的package包/类
private static void addArgs(@NotNull GeneralCommandLine command, @Nullable BrowserSpecificSettings settings, @NotNull String[] additional) {
  List<String> specific = settings == null ? Collections.<String>emptyList() : settings.getAdditionalParameters();
  if (specific.size() + additional.length > 0) {
    if (isOpenCommandUsed(command)) {
      if (BrowserUtil.isOpenCommandSupportArgs()) {
        command.addParameter("--args");
      }
      else {
        LOG.warn("'open' command doesn't allow to pass command line arguments so they will be ignored: " +
                 StringUtil.join(specific, ", ") + " " + Arrays.toString(additional));
        return;
      }
    }

    command.addParameters(specific);
    command.addParameters(additional);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:BrowserLauncherAppless.java

示例14: createVirtualEnv

import com.intellij.execution.configurations.GeneralCommandLine; //导入依赖的package包/类
@NotNull
public static String createVirtualEnv(@NotNull String destinationDir, String version) throws ExecutionException {
  final String condaExecutable = PyCondaPackageService.getCondaExecutable();
  if (condaExecutable == null) throw new PyExecutionException("Cannot find conda", "Conda", Collections.<String>emptyList(), new ProcessOutput());

  final ArrayList<String> parameters = Lists.newArrayList(condaExecutable, "create", "-p", destinationDir,
                                                          "python=" + version, "-y");

  final GeneralCommandLine commandLine = new GeneralCommandLine(parameters);
  final Process process = commandLine.createProcess();
  final CapturingProcessHandler handler = new CapturingProcessHandler(process);
  final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
  final ProcessOutput result = handler.runProcessWithProgressIndicator(indicator);
  if (result.isCancelled()) {
    throw new RunCanceledByUserException();
  }
  final int exitCode = result.getExitCode();
  if (exitCode != 0) {
    final String message = StringUtil.isEmptyOrSpaces(result.getStdout()) && StringUtil.isEmptyOrSpaces(result.getStderr()) ?
                           "Permission denied" : "Non-zero exit code";
    throw new PyExecutionException(message, "Conda", parameters, result);
  }
  final String binary = PythonSdkType.getPythonExecutable(destinationDir);
  final String binaryFallback = destinationDir + File.separator + "bin" + File.separator + "python";
  return (binary != null) ? binary : binaryFallback;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:PyCondaPackageManagerImpl.java

示例15: GitHandler

import com.intellij.execution.configurations.GeneralCommandLine; //导入依赖的package包/类
/**
 * A constructor
 *
 * @param project   a project
 * @param directory a process directory
 * @param command   a command to execute (if empty string, the parameter is ignored)
 */
protected GitHandler(@NotNull Project project, @NotNull File directory, @NotNull GitCommand command) {
  myProject = project;
  myCommand = command;
  myAppSettings = GitVcsApplicationSettings.getInstance();
  myProjectSettings = GitVcsSettings.getInstance(myProject);
  myEnv = new HashMap<String, String>(EnvironmentUtil.getEnvironmentMap());
  myVcs = ObjectUtils.assertNotNull(GitVcs.getInstance(project));
  myWorkingDirectory = directory;
  myCommandLine = new GeneralCommandLine();
  if (myAppSettings != null) {
    myCommandLine.setExePath(myAppSettings.getPathToGit());
  }
  myCommandLine.setWorkDirectory(myWorkingDirectory);
  if (GitVersionSpecialty.CAN_OVERRIDE_GIT_CONFIG_FOR_COMMAND.existsIn(myVcs.getVersion())) {
    myCommandLine.addParameters("-c", "core.quotepath=false");
  }
  myCommandLine.addParameter(command.name());
  myStdoutSuppressed = true;
  mySilent = myCommand.lockingPolicy() == GitCommand.LockingPolicy.READ;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:GitHandler.java


注:本文中的com.intellij.execution.configurations.GeneralCommandLine类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。