public Command getCommand() {
        String inputLine;
        String operator = null;
        ArrayList<String> captures = new ArrayList<String>();

        System.out.print("> ");

        inputLine = reader.nextLine();

        Scanner tokenizer = new Scanner(inputLine);
        if (tokenizer.hasNext()) {
            operator = tokenizer.next();
        }
        
        if (!commands.isCommand(operator)) {
            operator = null; //Invalidate the command to notify subsequent functions
        }  else {
            int[] captureGroups = commands.getCaptureGroups(operator);
            for(int groupSize : captureGroups){
                String segment = null;
                if(tokenizer.hasNext()){
                    segment = tokenizer.next().trim();
                    for(int i = 1; i < groupSize; i++){
                        if(tokenizer.hasNext()){
                            segment = segment + " " + tokenizer.next();
                        }
                    }
                    
                }
                if(segment!=null)captures.add(segment);
            }
        }
        
        tokenizer.close();
        
        return new Command(operator, captures);
    }