Пример #1
0
    def complete_start(self, _text, line, _begidx, _endidx):

        # Split arguments using shlex
        splitargs = shlex.split(line)

        # Autocompletion of different intents
        if splitargs[-1]:
            return [
                intent for intent in sorted(intentDictionary.itervalues())
                if intent.startswith(splitargs[-1])
            ]
        else:
            return sorted(intentDictionary.itervalues())
Пример #2
0
    def complete_send(self, _text, line, _begidx, _endidx):

        # Split arguments using shlex
        splitargs = shlex.split(line)

        # Autocompletion of different intents
        if splitargs[-1]:
            return [
                intent for intent in sorted(intentDictionary.itervalues())
                if intent.startswith(splitargs[-1])
            ]
        else:
            return sorted(intentDictionary.itervalues())
Пример #3
0
    def do_intents(self, args):
        """
List all actions/categories/extras with optional search filter
usage: intents [--filter <filter>]
        """

        # Define command-line arguments using argparse
        parser = argparse.ArgumentParser(prog='intents', add_help=False)
        parser.add_argument('--filter', '-f', metavar='<filter>')

        try:

            # Split arguments using shlex - this means that parameters with spaces can be used - escape " characters inside with \
            splitargs = parser.parse_args(shlex.split(args))

            print ""

            for value in sorted(intentDictionary.itervalues()):
                if splitargs.filter == None or value.upper().find(
                        splitargs.filter.upper()) > -1:
                    print value

            print ""

        # FIXME: Choose specific exceptions to catch
        except:
            pass
Пример #4
0
    def do_intents(self, args):
        """
List all actions/categories/extras with optional search filter
usage: intents [--filter <filter>]

--------------------------------
Example - getting all the intents actions with the keyword "call" in them
--------------------------------
*mercury#tools> intents -f call

android.intent.action.CALL
android.intent.action.CALL_BUTTON
android.intent.action.NEW_OUTGOING_CALL
        """

        # Define command-line arguments using argparse
        parser = argparse.ArgumentParser(prog = 'intents', add_help = False)
        parser.add_argument('--filter', '-f', metavar = '<filter>')

        try:

            # Split arguments using shlex - this means that parameters with spaces can be used - escape " characters inside with \
            splitargs = parser.parse_args(shlex.split(args))

            print ""

            for value in sorted(intentDictionary.itervalues()):
                if splitargs.filter == None or value.upper().find(splitargs.filter.upper()) > -1:
                    print value

            print ""

        # FIXME: Choose specific exceptions to catch
        except:
            pass
Пример #5
0
    def do_intents(self, args):
        """
List all actions/categories/extras with optional search filter
usage: intents [--filter <filter>]
        """

        # Define command-line arguments using argparse
        parser = argparse.ArgumentParser(prog = 'intents', add_help = False)
        parser.add_argument('--filter', '-f', metavar = '<filter>')

        try:

            # Split arguments using shlex - this means that parameters with spaces can be used - escape " characters inside with \
            splitargs = parser.parse_args(shlex.split(args))

            print ""

            for value in sorted(intentDictionary.itervalues()):
                if splitargs.filter == None or value.upper().find(splitargs.filter.upper()) > -1:
                    print value

            print ""

        # FIXME: Choose specific exceptions to catch
        except:
            pass
Пример #6
0
    def do_intents(self, args):
        """
List all actions/categories/extras with optional search filter
usage: intents [--filter <filter>] [--output <file>]

--------------------------------
Example - getting all the intents actions with the keyword "call" in them
--------------------------------
*mercury#tools> intents -f call

android.intent.action.CALL
android.intent.action.CALL_BUTTON
android.intent.action.NEW_OUTGOING_CALL
        """

        # Define command-line arguments using argparse
        parser = BaseArgumentParser(prog = 'intents', add_help = False)
        parser.add_argument('--filter', '-f', metavar = '<filter>')
        
        parser.setOutputToFileOption()

        try:

            # Split arguments using shlex - this means that parameters with spaces can be used - escape " characters inside with \
            splitargs = parser.parse_args(shlex.split(args),)

            print ""

            for value in sorted(intentDictionary.itervalues()):
                if splitargs.filter == None or value.upper().find(splitargs.filter.upper()) > -1:
                    print value

            print ""

        # FIXME: Choose specific exceptions to catch
        except Exception:
            pass