determine @command_mode
976593
def get_input
      command_line = super

      # This case statement decides the command mode,
      #  and which part of the input should be used for what...
      #  Note: Regexp match groups are used!
      @result_storage = @result_operator = nil

      @command_mode = case command_line
      # force ruby with a space
      when /^ /
        :ruby
      # regexp match shell commands
      when *Array( Ripl.config[:fresh_patterns] ).compact
        command_line     = $~[:command_line]     if $~.names.include? 'command_line'
        command          = $~[:command]          if $~.names.include? 'command'
        @result_operator = $~[:result_operator]  if $~.names.include? 'result_operator'
        @result_storage  = $~[:result_storage]   if $~.names.include? 'result_storage'
        forced           = !! $~[:force]         if $~.names.include? 'force'

        if forced
          :system
        elsif Ripl.config[:fresh_ruby_commands].include?( command )
          :ruby
        elsif Ripl.config[:fresh_mixed_commands].include?( command )
          :mixed
        elsif Ripl.config[:fresh_system_commands].include?( command )
          :system
        elsif Kernel.respond_to? command.to_sym
          :ruby
        else
          Ripl.config[:fresh_unknown_command_mode]
        end
      else
        Ripl.config[:fresh_default_mode]
      end

      command_line
    end
1300203
def mode_name(mode):
    ''''''

    if mode:
        l = mode.lower()

        if l in ('java', ):
            return ('clike', 'text/x-java')
        if l in ('c', ):
            return ('clike', 'text/x-csrc')
        if l in ('c++', 'cxx'):
            return ('clike', 'text/x-c++src')
        if l in ('csharp', 'c#'):
            return ('clike', 'text/x-csharp')

        if l in ('sh', 'bash', ):
            return ('shell', 'text/x-sh')

        if l in codemirror_modes:
            return (l, None)

    return (None, None)
151833
public int commandToDocType(String strCommand)
    {
        if (CLASS_DETAIL_SCREEN.equalsIgnoreCase(strCommand))
            return CLASS_DETAIL_MODE;
        if (RESOURCE_DETAIL_SCREEN.equalsIgnoreCase(strCommand))
            return RESOURCE_DETAIL_MODE;
        return super.commandToDocType(strCommand);
    }
651298
def exit_enable_mode(self, exit_command=""):
        
        output = ""
        if self.check_enable_mode():
            self.write_channel(self.normalize_cmd(exit_command))
            output += self.read_until_prompt()
            if self.check_enable_mode():
                raise ValueError("Failed to exit enable mode.")
        return output
1153629
def get_mode(device):
    '''
    
    '''
    ret = {}
    cmd = 'quotaon -p {0}'.format(device)
    out = __salt__['cmd.run'](cmd, python_shell=False)
    for line in out.splitlines():
        comps = line.strip().split()
        if comps[3] not in ret:
            if comps[0].startswith('quotaon'):
                if comps[1].startswith('Mountpoint'):
                    ret[comps[4]] = 'disabled'
                    continue
                elif comps[1].startswith('Cannot'):
                    ret[device] = 'Not found'
                    return ret
                continue
            ret[comps[3]] = {
                'device': comps[4].replace('(', '').replace(')', ''),
            }
        ret[comps[3]][comps[0]] = comps[6]
    return ret
45771
def detect_mode(cls, **params):
        
        modes = []
        for mode in cls.modes:
            if params.get(mode) is not None:
                modes.append(mode)
        if len(modes) > 1:
            error_message = 'ambiguous mode, must be one of {}'
            modes_csv = ', '.join(list(cls.modes))
            raise ValueError(error_message.format(modes_csv))
        return modes[0] if modes else cls.default_mode
1019145
def capture_command        
      cmd = "#{@cutycapt_path} --url='#{@url}'"
      cmd += " --out='#{@folder}/#{@filename}'"
      cmd += " --max-wait=#{@max_wait}"
      cmd += " --delay=#{@delay}" if @delay
      cmd += " --user-agent='#{@user_agent}'"
      cmd += " --min-width='#{@min_width}'"
      cmd += " --min-height='#{@min_height}'"

      
      if determine_os == :linux and check_xvfb
        xvfb = 'xvfb-run --server-args="-screen 0, 1024x768x24" '
        xvfb.concat(cmd)
      else
        cmd
      end        
    end
152982
def command?(command)
      MakeMakefile::Logging.instance_variable_set :@logfile, File::NULL
      MakeMakefile::Logging.quiet = true
      MakeMakefile.find_executable command.to_s
    end
349217
def parse
      @commands.each do |_, cmd|
        if cmd.flags?
          # or for the || seems to not do what I want it to do...
          next unless argv_index = ARGV.index(cmd.flags.short) || ARGV.index(cmd.flags.long)
        else
          next unless argv_index = ARGV.index(cmd.index.to_s)
        end
        cmd.given = true unless argv_index.nil?
        if cmd.type.nil?
          yield cmd if block_given?
        else
          if parsed = parse_cmd(cmd, flags)
            cmd.arguments = parsed || cmd.default
            yield cmd if block_given?
          elsif cmd.default
            cmd.arguments = cmd.default
            yield cmd if block_given?
          end
        end
      end
    end
816978
def do_mode(self, args):
        ''''''
        if args.mode:
            mode = { 'idle': self.task_master.IDLE,
                     'run': self.task_master.RUN,
                     'terminate': self.task_master.TERMINATE }[args.mode]
            self.task_master.set_mode(mode)
            self.stdout.write('set mode to {0!r}\n'.format(args.mode))
        else:
            mode = self.task_master.get_mode()
            self.stdout.write('{0!s}\n'.format(mode))
1045234
def eval_command(self, cmd):
        
        if cmd == 'restart':
            self.restart()

        elif cmd == 'stop':
            self.stop()

        else:
            raise ValueError("Unknown Command passed to controller! %s" % cmd)
750864
def post_operations(self, mode=None):
        
        version_mode = self._get_version_mode(mode=mode)
        return version_mode.post_operations
1000061
def fetch_command_target(exp=parent)

      case exp
        when nil then nil
        when Ruote::Exp::CommandedExpression then exp
        else fetch_command_target(exp.parent)
      end
    end
1258366
def mode(dev, target):
    
    click.echo("Current mode: %s" % dev.mode_readable)
    if target:
        click.echo("Setting mode: %s" % target)
        dev.mode = target
1310521
function mode() {
      var value = (attr.mdMode || "").trim();
      if (value) {
        switch (value) {
          case MODE_DETERMINATE:
          case MODE_INDETERMINATE:
          case MODE_BUFFER:
          case MODE_QUERY:
            break;
          default:
            value = MODE_INDETERMINATE;
            break;
        }
      }
      return value;
    }
611161
def match(self, command_context=None, **command_env):
		
		spec = self.specification()
		if command_context is None and spec is None:
			return True
		elif command_context is not None and spec is not None:
			return command_context == spec
		return False
565233
def mode(self):
        """"""
        if self._resources is None:
            self.__init()
        if "mode" in self._resources:
            url = self._url + "/mode"
            return _mode.Mode(url=url,
                              securityHandler=self._securityHandler,
                              proxy_url=self._proxy_url,
                              proxy_port=self._proxy_port,
                              initialize=True)
        else:
            return None