Beispiel #1
0
def get_shell_commands(shell_command_line):
    '''Given a shell command line, get a list of Command objects'''
    comm_list = general.split_command(shell_command_line)
    cleaned_list = []
    for comm in comm_list:
        cleaned_list.append(Command(general.clean_command(comm)))
    return cleaned_list
Beispiel #2
0
def get_shell_commands(shell_command_line):
    '''Given a shell command line, get a list of Command objects'''
    statements = general.split_command(shell_command_line)
    command_list = []
    # traverse the statements, pick out the loop and commands.
    for stat in statements:
        if 'command' in stat:
            command_list.append(Command(stat['command']))
        elif 'loop' in stat:
            loop_stat = stat['loop']['loop_statements']
            for st in loop_stat:
                if 'command' in st:
                    command_list.append(Command(st['command']))
    return command_list
Beispiel #3
0
def get_shell_commands(shell_command_line):
    '''Given a shell command line, get a list of Command objects and report on
    branch statements'''
    statements = general.split_command(shell_command_line)
    command_list = []
    branch_report = ''
    # traverse the statements, pick out the loop and commands.
    for stat in statements:
        if 'command' in stat:
            command_list.append(Command(stat['command']))
        elif 'loop' in stat:
            loop_stat = stat['loop']['loop_statements']
            for st in loop_stat:
                if 'command' in st:
                    command_list.append(Command(st['command']))
        elif 'branch' in stat:
            branch_report = branch_report + '\n'.join(stat['content']) + '\n\n'
    if branch_report:
        # add prefix
        branch_report = '\nNon-deterministic branching statement: \n' + \
                        branch_report
    return command_list, branch_report