Exemplo n.º 1
0
    def __init__(self):
        super().__init__()
        self.name = 'device'
        self.description = '📈 Statistics about your device'

        self.commands = {
            'battery':
            Command(
                description='🔋 see information about the state of your battery'
            ),
            'reboot':
            Command(description='⚡ safely reboot your device'),
            'shutdown':
            Command(description='🔌 safely shutdown your device',
                    flags=[
                        Flag(['-r', '--reboot'],
                             'An alternate way to reboot your device',
                             dtype='bool')
                    ]),
            'settings':
            Command(description='⚙️ open the Settings app',
                    flags=[
                        Flag(['-c', '--close'],
                             'Closes the settings application',
                             dtype='bool')
                    ])
        }
Exemplo n.º 2
0
  def __init__(self):
    super().__init__()
    self.name = 'debug'
    self.description = 'de-🐛-ing tools'

    self.commands = {'controlsd': Command(description='🔬 logs controlsd to /data/output.log by default',
                                          flags=[Flag(['-o', '--output'], 'Name of file to save log to', dtype='str')]),
                     'reload': Command(description='🔄 kills the current openpilot session and restarts it (all without rebooting)')}
Exemplo n.º 3
0
    def __init__(self):
        super().__init__()
        self.name = 'fork'
        self.description = '🍴 Manage installed forks, or install a new one'

        self.fork_params = ForkParams()
        self.remote_defaults = {
            'commaai':
            RemoteInfo('openpilot', ['stock', 'origin'], 'release2'),
            'dragonpilot-community':
            RemoteInfo('dragonpilot', ['dragonpilot'], 'devel-i18n')
        }  # devel-i18n isn't most stable, but its name remains the same

        self.comma_origin_name = 'commaai'
        self.comma_default_branch = self.remote_defaults[
            'commaai'].default_branch

        self.commands = {
            'switch':
            Command(
                description='🍴 Switch between any openpilot fork',
                flags=[
                    Flag(
                        'username',
                        '👤 The username of the fork\'s owner to switch to, will use current fork if not provided',
                        required=False,
                        dtype='str'),
                    Flag(
                        ['-b', '--branch'],
                        '🌿 Branch to switch to, will use default branch if not provided',
                        required=False,
                        dtype='str'),
                    Flag(
                        ['-r', '--repo'],
                        'The repository name of the fork, if its name isn\'t openpilot',
                        required=False,
                        dtype='str'),
                    Flag([
                        '-f', '--force'
                    ], '💪 Similar to checkout -f, force checks out new branch overwriting any changes'
                         )
                ]),
            'list':
            Command(description='📜 See a list of installed forks and branches',
                    flags=[
                        Flag('fork',
                             '🌿 See branches of specified fork',
                             dtype='str')
                    ])
        }
Exemplo n.º 4
0
 def test_create_command_with_custom_gphome(self):
     self.subject = Command("my name",
                            "my command string",
                            ctxt=REMOTE,
                            remoteHost="someHost",
                            gphome="/new/gphome")
     self.assertIn("/new/gphome", self.subject.exec_context.gphome)
Exemplo n.º 5
0
    def __init__(self):
        super().__init__()
        self.name = 'panda'
        self.description = '🐼 panda interfacing tools'

        self.commands = {
            'flash':
            Command(
                description=
                '🐼 flashes panda with make recover (usually works with the C2)'
            ),
            'flash2':
            Command(
                description=
                '🎍 flashes panda using Panda module (usually works with the EON)'
            )
        }
Exemplo n.º 6
0
    def __init__(self):
        super().__init__()
        self.name = 'debug'
        self.description = 'de-🐛-ing tools'

        self.commands = {
            'controlsd':
            Command(
                description='🔬 logs controlsd to /data/output.log by default',
                flags=[
                    Flag(['-o', '--output'],
                         'Name of file to save log to',
                         dtype='str')
                ])
        }
        self.default_path = '/data/output.log'
Exemplo n.º 7
0
 def test_running_command_remembers_pid(self):
     self.subject = Command("my name", "ls")
     self.subject.pid = -1
     self.subject.run()
     self.assertTrue(self.subject.pid > 0)
Exemplo n.º 8
0
 def test_create_command_with_default_gphome(self):
     self.subject = Command("my name",
                            "my command string",
                            ctxt=REMOTE,
                            remoteHost="someHost")
     self.assertEquals(GPHOME, self.subject.exec_context.gphome)
Exemplo n.º 9
0
 def setUp(self):
     self.subject = Command("my name", "my command string")