Return {@link CLI} for jenkins docker container.
// TODO no way specify CliPort (hacky resolution {@link DockerCLI})
176139
public DockerCLI createCliForInspect(InspectContainerResponse inspect)
            throws IOException, InterruptedException {
        LOG.debug("Creating CLI for {}", inspect);
        Integer httpPort = null;
        // CLI mess around ports
        Integer cliPort = null; // should be this
        Integer jnlpAgentPort = null; // but in reality used this

        final Map<ExposedPort, Ports.Binding[]> bindings = inspect.getNetworkSettings().getPorts().getBindings();
        LOG.trace("Bindings: {}", bindings);
        for (Map.Entry<ExposedPort, Ports.Binding[]> entry : bindings.entrySet()) {
            if (entry.getKey().getPort() == JENKINS_DEFAULT.httpPort) {
                httpPort = Integer.valueOf(entry.getValue()[0].getHostPortSpec());
            }
            if (entry.getKey().getPort() == JENKINS_DEFAULT.tcpPort) {
                final Ports.Binding binding = entry.getValue()[0];
                jnlpAgentPort = Integer.valueOf(binding.getHostPortSpec());
            }
            if (entry.getKey().getPort() == JENKINS_DEFAULT.jnlpPort) {
                cliPort = Integer.valueOf(entry.getValue()[0].getHostPortSpec());
            }
        }
        LOG.trace("Creating URL {}", bindings);
        final URL url = new URL("http://" + getHost() + ":" + httpPort.toString());
        LOG.trace("Created URL {}", url.toExternalForm());

        if (isNull(jnlpAgentPort)) {
            throw new IOException("Can't get jnlpPort." + bindings.toString());
        }
        return createCliWithWait(url, jnlpAgentPort);
    }
205393
@Override
    protected <T> T getCommand(Class<T> clazz) {
        return getCommand(commands, clazz, this, api, extension);
    }
1006621
function getCLIParamsConfig(config, commander) {
  let {
    file,
    pathFile,
    dir,
    useJsModules,
    landBase,
    numWorkers,
    skipVerify,
    decaffeinatePath,
    jscodeshiftPath,
    eslintPath,
  } = commander;
  // As a special case, specifying files to process from the CLI should cause
  // any equivalent config file settings to be ignored.
  if ((file && file.length > 0) || dir || pathFile) {
    config.filesToProcess = null;
    config.searchDirectory = null;
    config.pathFile = null;
  }

  if (file && file.length > 0) {
    config.filesToProcess = file;
  }
  if (dir) {
    config.searchDirectory = dir;
  }
  if (pathFile) {
    config.pathFile = pathFile;
  }
  if (useJsModules) {
    config.useJSModules = true;
  }
  if (landBase) {
    config.landBase = landBase;
  }
  if (numWorkers) {
    config.numWorkers = numWorkers;
  }
  if (skipVerify) {
    config.skipVerify = true;
  }
  if (decaffeinatePath) {
    config.decaffeinatePath = decaffeinatePath;
  }
  if (jscodeshiftPath) {
    config.jscodeshiftPath = jscodeshiftPath;
  }
  if (eslintPath) {
    config.eslintPath = eslintPath;
  }
  return config;
}
1248573
def cli(self):
        
        if self._cli is None:
            self._cli = self.create_interface()
        return self._cli
819382
public alluxio.grpc.RunTaskCommandOrBuilder getRunTaskCommandOrBuilder() {
    return runTaskCommand_ == null ? alluxio.grpc.RunTaskCommand.getDefaultInstance() : runTaskCommand_;
  }
182033
public static CmsShell getTopShell() {

        ArrayList<CmsShell> shells = SHELL_STACK.get();
        if (shells.isEmpty()) {
            return null;
        }
        return shells.get(shells.size() - 1);

    }
599176
public ContainerStart start(String containerId) {
		ContainerStart command = new ContainerStart();
		command.container(containerId);
		action.setCommand(command);
		return command;
	}
477509
public com.github.dockerjava.api.DockerClient getDockerClient() {
        if (dockerClient == null) {
            dockerClient = createDockerClient();
        }

        return dockerClient;
    }
418004
def docker_call(tool, tool_parameters, work_dir, java_opts=None, outfile=None,
                dockerhub='aarjunrao', interactive=False):
    
    # If an outifle has been provided, then ensure that it is of type file, it is writeable, and
    # that it is open.
    if outfile:
        assert isinstance(outfile, file), 'outfile was not passsed a file'
        assert outfile.mode in ['w', 'a', 'wb', 'ab'], 'outfile not writeable'
        assert not outfile.closed, 'outfile is closed'
    # If the call is interactive, set intereactive to -i
    if interactive:
        interactive = '-i'
    else:
        interactive = ''
    # If a tag is passed along with the image, use it.
    if ':' in tool:
        docker_tool = '/'.join([dockerhub, tool])
    # Else use 'latest'
    else:
        docker_tool = ''.join([dockerhub, '/', tool, ':latest'])
    # Get the docker image on the worker if needed
    call = ['docker', 'images']
    dimg_rv = subprocess.check_output(call)
    existing_images = [':'.join(x.split()[0:2]) for x in dimg_rv.splitlines()
                       if x.startswith(dockerhub)]
    if docker_tool not in existing_images:
        try:
            call = ' '.join(['docker', 'pull', docker_tool]).split()
            subprocess.check_call(call)
        except subprocess.CalledProcessError as err:
            raise RuntimeError('docker command returned a non-zero exit status ' +
                               '(%s)' % err.returncode + 'for command \"%s\"' % ' '.join(call),)
        except OSError:
            raise RuntimeError('docker not found on system. Install on all' +
                               ' nodes.')
    # If java options have been provided, it needs to be in the docker call
    if java_opts:
        base_docker_call = ' docker run -e JAVA_OPTS=-Xmx{} '.format(java_opts) + '--rm=true ' + \
            '-v {}:/data --log-driver=none '.format(work_dir) + interactive
    else:
        base_docker_call = ' docker run --rm=true -v {}:/data '.format(work_dir) + \
            '--log-driver=none ' + interactive
    call = base_docker_call.split() + [docker_tool] + tool_parameters
    try:
        subprocess.check_call(call, stdout=outfile)
    except subprocess.CalledProcessError as err:
        raise RuntimeError('docker command returned a non-zero exit status (%s)' % err.returncode +
                           'for command \"%s\"' % ' '.join(call),)
    except OSError:
        raise RuntimeError('docker not found on system. Install on all nodes.')
1229584
public Dock getDock() {
        return options.dock != null ? Dock.fromStyleName(options.dock) : null;
    }
205
@Restricted(NoExternalUse.class)
    public static @Nonnull JenkinsLocationConfiguration getOrDie(){
        JenkinsLocationConfiguration config = JenkinsLocationConfiguration.get();
        if (config == null) {
            throw new IllegalStateException("JenkinsLocationConfiguration instance is missing. Probably the Jenkins instance is not fully loaded at this time.");
        }
        return config;
    }
560004
function dockerContainers(all, callback) {

  function inContainers(containers, id) {
    let filtered = containers.filter(obj => {
      /**
       * @namespace
       * @property {string}  Id
       */
      return (obj.Id && (obj.Id === id));
    });
    return (filtered.length > 0);
  }

  // fallback - if only callback is given
  if (util.isFunction(all) && !callback) {
    callback = all;
    all = false;
  }

  all = all || false;
  let result = [];
  return new Promise((resolve) => {
    process.nextTick(() => {
      if (!_docker_socket) {
        _docker_socket = new DockerSocket();
      }

      _docker_socket.listContainers(all, data => {
        let docker_containers = {};
        try {
          docker_containers = data;
          if (docker_containers && Object.prototype.toString.call(docker_containers) === '[object Array]' && docker_containers.length > 0) {
            docker_containers.forEach(function (element) {
              /**
               * @namespace
               * @property {string}  Id
               * @property {string}  Name
               * @property {string}  Image
               * @property {string}  ImageID
               * @property {string}  Command
               * @property {number}  Created
               * @property {string}  State
               * @property {Array}  Names
               * @property {Array}  Ports
               * @property {Array}  Mounts
               */

              if (element.Names && Object.prototype.toString.call(element.Names) === '[object Array]' && element.Names.length > 0) {
                element.Name = element.Names[0].replace(/^\/|\/$/g, '');
              }
              result.push({
                id: element.Id,
                name: element.Name,
                image: element.Image,
                imageID: element.ImageID,
                command: element.Command,
                created: element.Created,
                state: element.State,
                ports: element.Ports,
                mounts: element.Mounts,
                // hostconfig: element.HostConfig,
                // network: element.NetworkSettings
              });
            });
          }
        } catch (err) {
          util.noop();
        }
        // }

        // GC in _docker_container_stats
        for (let key in _docker_container_stats) {
          if (_docker_container_stats.hasOwnProperty(key)) {
            if (!inContainers(docker_containers, key)) delete _docker_container_stats[key];
          }
        }
        if (callback) { callback(result); }
        resolve(result);
      });
    });
  });
}
577596
def cli():
    """"""
    objcli = WrHierCli(sys.argv[1:])
    fouts_txt = objcli.get_fouts()
    if fouts_txt:
        for fout_txt in fouts_txt:
            objcli.wrtxt_hier(fout_txt)
    else:
        objcli.prt_hier(sys.stdout)
181428
public static RunOptions parseRunCommand(String[] args) throws CliArgsException {
		try {
			DefaultParser parser = new DefaultParser();
			CommandLine line = parser.parse(RUN_OPTIONS, args, true);
			return new RunOptions(line);
		}
		catch (ParseException e) {
			throw new CliArgsException(e.getMessage());
		}
	}
822164
public alluxio.grpc.FileSystemCommand getCommand() {
    return command_ == null ? alluxio.grpc.FileSystemCommand.getDefaultInstance() : command_;
  }
310355
public String containerName() {
    final String shortId = job.getId().toShortString();
    final String escaped = CONTAINER_NAME_FORBIDDEN.matcher(shortId).replaceAll("_");
    final String random = Integer.toHexString(new SecureRandom().nextInt());
    return namespace + "-" + escaped + "_" + random;
  }
42770
def do_cli(ctx, host, port, template, env_vars, debug_port, debug_args,  # pylint: disable=R0914
           debugger_path, docker_volume_basedir, docker_network, log_file, layer_cache_basedir, skip_pull_image,
           force_image_build, parameter_overrides):
    

    LOG.debug("local start_lambda command is called")

    # Pass all inputs to setup necessary context to invoke function locally.
    # Handler exception raised by the processor for invalid args and print errors

    try:
        with InvokeContext(template_file=template,
                           function_identifier=None,  # Don't scope to one particular function
                           env_vars_file=env_vars,
                           docker_volume_basedir=docker_volume_basedir,
                           docker_network=docker_network,
                           log_file=log_file,
                           skip_pull_image=skip_pull_image,
                           debug_port=debug_port,
                           debug_args=debug_args,
                           debugger_path=debugger_path,
                           parameter_overrides=parameter_overrides,
                           layer_cache_basedir=layer_cache_basedir,
                           force_image_build=force_image_build,
                           aws_region=ctx.region) as invoke_context:

            service = LocalLambdaService(lambda_invoke_context=invoke_context,
                                         port=port,
                                         host=host)
            service.start()

    except (InvalidSamDocumentException,
            OverridesNotWellDefinedError,
            InvalidLayerReference,
            DebuggingNotSupported) as ex:
        raise UserException(str(ex))