Skip to main content

flashcli

Project description

pip install fastcli

Framework

轻量级终端指令框架,pip install fastcli即可在自己的项目接入。只要创建一个存放命令的文件夹cmds即可。

初始化框架

import fast
def entry():
    fast.load_cmds(__file__, 'cmds')

在cmds目录下面编写自己的指令

from fast import BaseCommand
from fast import (
    get_model, get_brand, get_name,
    get_wm_size, get_wm_density, get_android_version,
    get_imeis, get_ip_and_mac, get_board,
    get_abilist, get_cpu_core_size, get_heap_size,
)
from fast import print_with_bar


class DeviceInfo(BaseCommand):
    # 声明指令的功能
    def _create_parser(self, p):
        pyadb_parser = p.add_parser('device-info')
        pyadb_parser.add_argument('-b', '--basic', action='store_true',
                                  help='device basic info')
        pyadb_parser.add_argument('--top_activity', action='store_true',
                                  help='top activity')
        pyadb_parser.add_argument(
            '-i', '--imei', action='store_true', help='get imei')
        return pyadb_parser

    # 获取指令中的数据
    def _parse_args(self, args: "ArgumentParser"):
        self.__basic = args.basic

    # 执行指令的逻辑
    def _execute(self):
        if self.__basic:
            print_with_bar(0, 'model:', get_model(self._serial_no))
            print_with_bar(1, 'brand:', get_brand(self._serial_no))
            print_with_bar(2, 'name:', get_name(self._serial_no))
            print_with_bar(3, 'wm size:', get_wm_size(self._serial_no))
            print_with_bar(4, 'wm density:', get_wm_density(self._serial_no))
            print_with_bar(5, 'android version:',
                           get_android_version(self._serial_no))
            print_with_bar(6, 'imei:', get_imeis(self._serial_no))
            print_with_bar(7, 'ip/mac:', get_ip_and_mac(self._serial_no))
            print_with_bar(8, 'board:', get_board(self._serial_no))
            print_with_bar(9, 'abilist:', get_abilist(self._serial_no))
            print_with_bar(10, 'cpu core size:',
                           get_cpu_core_size(self._serial_no))
            print_with_bar(11, 'heap size/m:', get_heap_size(self._serial_no))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flashcli-1.3.0-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

File details

Details for the file flashcli-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: flashcli-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 25.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.10.6 Darwin/21.2.0

File hashes

Hashes for flashcli-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1fbc48da4d60cbab7e4a41619f128086507f3bc62bd94073f842d51b11a293b4
MD5 a0d1264ea4b62605e2fa1b30a5436cca
BLAKE2b-256 c5eaa56e901951d888df726a03258314ae6791b85576f46c6bfd8f488913372e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page