<editor-fold desc="Circles & commands">
12024
function executeCommand(command, circles, current, position) {
            var circle = circles[current],
                transformed = false;

            switch (command) {
                case 'increase-x':
                    circle.x += 10;
                    transformed = true;
                    break;
                case 'decrease-x':
                    circle.x -= 10;
                    transformed = true;
                    break;
                case 'increase-y':
                    circle.y += 10;
                    transformed = true;
                    break;
                case 'decrease-y':
                    circle.y -= 10;
                    transformed = true;
                    break;
                case 'increase-r':
                    circle.r += 10;
                    transformed = true;
                    break;
                case 'decrease-r':
                    circle.r -= 10;
                    transformed = true;
                    break;
                case 'bring-to-front':
                    bringToFront(circles, circle, current);
                    break;
                case 'send-to-back':
                    sendToBack(circles, circle, current);
                    break;
                case 'new-circle':
                    newCircle(position, circles, TOOLBAR_HEIGHT);
                    break;
                case 'random-circle':
                    randomCircle(circles, TOOLBAR_HEIGHT);
                    break;
                case 'remove-circle':
                    removeCircle(circles, current);
                    break;
                case 'move':
                    moveCircles(circles, position);
                    break;
                case 'clear':
                    clear(circles);
                    break;
            }

            if (transformed) {
                circle.x = Math.max(circle.x, 10);
                circle.y = Math.max(circle.y, 10);
                circle.r = Math.max(circle.r, 10);
            }

            return circles;
        }
83536
def command_objects(names=self.commands, command_array=Boson.commands)
      command_array.select {|e| names.include?(e.name) && e.lib == self.name }
    end
437886
function commandListTitle(command, context) {
  const url  = (context === 'README') ? `/docs/commands/${command}.md` : `/commands/${command}`
  // const url  = (context === 'README') ? `/docs/${command}.md` : `/${command}`
  return `### [${command}](${url})${newLine}`
}
1114196
public static <A, B> BaseListCommand<A, B> and(Iterable<? extends Command<A, B>> commands) {
        return new AndCommand<>(commands);
    }
525382
def as_es2_command(command):
    

    if command[0] == 'FUNC':
        return (command[0], re.sub(r'^gl([A-Z])',
                lambda m: m.group(1).lower(), command[1])) + command[2:]
    if command[0] == 'SHADERS':
        return command[:2] + convert_shaders('es2', command[2:])
    if command[0] == 'UNIFORM':
        return command[:-1] + (command[-1].tolist(),)
    return command
281404
function jsdocCommand( jsdoc ) {
	var cmd = [];
	cmd.unshift( jsdoc.options );
	if ( jsdoc.tutorials.length > 0 ) {
		cmd.push( "-u " + path.resolve( jsdoc.tutorials ) );
	}
	cmd.push( "-d " + path.resolve( jsdoc.dest ) );
	cmd.push( "-t " + path.resolve( jsdoc.template ) );
	cmd.push( "-c " + path.resolve( jsdoc.config ) );
	sys.each( jsdoc.src, function ( src ) {
		cmd.push( path.resolve( src ) );
	} );
	cmd.unshift( path.resolve( "./node_modules/jsdoc/jsdoc" ) );
	cmd.unshift( "node" );

	return cmd.join( " " );
}
600697
def list_commands(self, ctx):
        """"""
        commands = super(LegitGroup, self).list_commands(ctx)
        return [cmd for cmd in order_manually(commands)]
1150507
function (cmd, callback) {
    var cmdName = dotty.get(cmd, this.definitions.command.name);

    var err;
    if (!cmdName) {
      err = new Error('command has no command name in ' + this.definitions.command.name);
      debug(err);
      return callback(err);
    }

    var version = 0;
    if (!!this.definitions.command.version) {
      version = dotty.get(cmd, this.definitions.command.version);
    }

    var command = this.getCommand(cmdName, version);
    if (!command) {
      err = new Error('Command "' + cmdName + '" not found!');
      debug(err);
      return callback(err);
    }

    if (command.validate.length >= 2) {
      return command.validate(cmd, callback);
    }

    try {
      callback(command.validate(cmd));
    } catch (e) {
      callback(e);
    }
  }
689268
function _Overlay_resolveCommands(commands) {
                    // First make sure they're all DOM elements.
                    commands = _resolveElements(commands);

                    // Now make sure they're all in this container
                    var result = {};
                    result.commands = [];
                    result.others = [];
                    var allCommands = this.element.querySelectorAll(".win-command");
                    var countAll, countIn;
                    for (countAll = 0; countAll < allCommands.length; countAll++) {
                        var found = false;
                        for (countIn = 0; countIn < commands.length; countIn++) {
                            if (commands[countIn] === allCommands[countAll]) {
                                result.commands.push(allCommands[countAll]);
                                commands.splice(countIn, 1);
                                found = true;
                                break;
                            }
                        }
                        if (!found) {
                            result.others.push(allCommands[countAll]);
                        }
                    }
                    return result;
                }
1311671
public static void main(String[] args) {
		try {
		  jCommander = new JCommander();
		  	  
		  jCommander.setProgramName("cadmium");
		  
		  HelpCommand helpCommand = new HelpCommand();
		  jCommander.addCommand("help", helpCommand);
      
      Map<String, CliCommand> commands = wireCommands(jCommander);
		  try {
		    jCommander.parse(args);
		  } catch(ParameterException pe) {
		    System.err.println(pe.getMessage());
		    System.exit(1);
		  }
		  
		  String commandName = jCommander.getParsedCommand();
		  if( commandName == null ) {
		    System.out.println("Please use one of the following commands:");
		    for(String command : jCommander.getCommands().keySet() ) {
		      String desc = jCommander.getCommands().get(command).getObjects().get(0).getClass().getAnnotation(Parameters.class).commandDescription();
		      System.out.format("   %16s    -%s\n", command, desc);
		    }
		  } 
		  else if( commandName.equals("help") ) {
			  if( helpCommand.subCommand == null || helpCommand.subCommand.size()==0 ) {
				  jCommander.usage();
				  return;
			  }
			  else {
				 JCommander subCommander = jCommander.getCommands().get(helpCommand.subCommand.get(0));
				 if( subCommander == null ) {
					 System.out.println("Unknown sub command "+commandName);
					 return;
				 }
				 subCommander.usage();
				 return;
			  }
		  } 
		  else if(commands.containsKey(commandName)){
		    CliCommand command = commands.get(commandName);
		    if(command instanceof AuthorizedOnly) {
		      setupSsh(((AuthorizedOnly) command).isAuthQuiet());
		      setupAuth((AuthorizedOnly) command);
		    }
		    command.execute();
		  }
		
		}
		catch( Exception e ) {
			System.err.println("Error: " + e.getMessage());
			logger.debug("Cli Failed", e);
			e.printStackTrace();
			System.exit(1);
		}

	}
1245430
def process_command(command: CommandInput, matrix: VarMatrix) -> List[Command]:
    
    assert command is not None
    if isinstance(command, str):
        command_list = [Command(command, variables=variables) for variables in matrix]
    elif isinstance(command, list):
        command_list = [Command(command, variables=variables) for variables in matrix]
    else:
        if command.get("command") is not None:
            cmd = command.get("command")
        else:
            cmd = command.get("cmd")
        creates = str(command.get("creates", ""))
        requires = str(command.get("requires", ""))

        assert isinstance(cmd, (list, str))
        command_list = [
            Command(cmd, variables, creates, requires) for variables in matrix
        ]
    return uniqueify(command_list)
417449
function getCommandNames(cmds) {
  var commands = _.map(cmds, '_name');
  commands = commands.concat.apply(commands, _.map(cmds, '_aliases'));
  commands.sort();
  return commands;
}
1136111
function commands(req, res /*, next */) {
  req.app.commands.forEach(function(command) {
    res.writeln(command);
  });
  res.end();
}
450218
public static <A, B> BaseListCommand<A, B> and(Command<A, B> first, Command<A, B> second) {
        List<Command<A, B>> list = Lists.newArrayList();
        list.add(first);
        list.add(second);
        return new AndCommand<>(list);
    }
862684
def display_commands( cmdlist )
      maxlen = 0
      cmdlist.each do |cmd|
	maxlen = cmd.name.length if cmd.name.length > maxlen
      end
      cmdlist.each do |cmd|
	print '  ' + cmd.name
	print "#{' ' * (maxlen - cmd.name.length)}  # "
	puts cmd.brief
      end
    end
188889
function getMatchingCommands(context, prefix) {
  var commands = cli.getMapping(context).requisition.system.commands;
  var reply = commands.getAll().filter(function(command) {
    if (command.hidden) {
      return false;
    }

    if (prefix && command.name.indexOf(prefix) !== 0) {
      // Filtered out because they don't match the search
      return false;
    }
    if (!prefix && command.name.indexOf(' ') != -1) {
      // We don't show sub commands with plain 'help'
      return false;
    }
    return true;
  });

  reply.sort(function(c1, c2) {
    return c1.name.localeCompare(c2.name);
  });

  reply = reply.map(function(command) {
    return command.toJson();
  });

  return reply;
}
736619
def plotdmt(data, circleinds=[], crossinds=[], edgeinds=[], url_path=None, fileroot=None,
            tools="hover,tap,pan,box_select,wheel_zoom,reset", plot_width=950, plot_height=500):
    

    fields = ['dm', 'time', 'sizes', 'colors', 'snrs', 'key']

    if not circleinds: circleinds = range(len(data['snrs']))

    # set ranges
    datalen = len(data['dm'])
    inds = circleinds + crossinds + edgeinds
    dm = [data['dm'][i] for i in inds]
    dm_min = min(min(dm), max(dm)/1.2)
    dm_max = max(max(dm), min(dm)*1.2)
    time = [data['time'][i] for i in inds]
    time_min = min(time)
    time_max = max(time)

    source = ColumnDataSource(data = dict({(key, tuple([value[i] for i in circleinds if i not in edgeinds])) 
                                           for (key, value) in data.iteritems() if key in fields}))
    dmt = Figure(plot_width=plot_width, plot_height=plot_height, toolbar_location="left", x_axis_label='Time (s; relative)',
                 y_axis_label='DM (pc/cm3)', x_range=(time_min, time_max), y_range=(dm_min, dm_max), 
                 output_backend='webgl', tools=tools)
    dmt.circle('time', 'dm', size='sizes', fill_color='colors', line_color=None, fill_alpha=0.2, source=source)

    if crossinds:
        sourceneg = ColumnDataSource(data = dict({(key, tuple([value[i] for i in crossinds]))
                                                  for (key, value) in data.iteritems() if key in fields}))
        dmt.cross('time', 'dm', size='sizes', fill_color='colors', line_alpha=0.3, source=sourceneg)

    if edgeinds:
        sourceedge = ColumnDataSource(data = dict({(key, tuple([value[i] for i in edgeinds]))
                                                   for (key, value) in data.iteritems() if key in fields}))
        dmt.circle('time', 'dm', size='sizes', line_color='colors', fill_color='colors', line_alpha=0.5, fill_alpha=0.2, source=sourceedge)
    hover = dmt.select(dict(type=HoverTool))
    hover.tooltips = OrderedDict([('SNR', '@snrs'), ('key', '@key')])

    if url_path and fileroot:
#        url = '{}/cands_{}_sc@scan-seg@seg-i@candint-dm@dmind-dt@dtind.png'.format(url_path, fileroot)
        url = '{}/cands_{}_@key.png'.format(url_path, fileroot)
        taptool = dmt.select(type=TapTool)
        taptool.callback = OpenURL(url=url)

    return dmt