from util import add_arg from board import BoardError from flasher import Flasher, FlasherError from printing import dprint, eprint argparse_flash = ( add_arg('-l', '--list', dest='list', action='store_true', help='list firmware versions (no flashing)', default=False), add_arg( '-e', '--erase', dest='erase', action='store_true', help= 'erase flash memory (including file system) before flashing firmware', default=False), add_arg('-v', '--version', dest='version', help='firmware version', default='STABLE'), add_arg('-b', '--board', dest='board', help='microcontroller board (e.g. HUZZAH32)', default=None), )
from util import add_arg from fileops import auto, resolve_path, is_pattern, process_pattern, get_mode, \ mkdir, cp, rsync, listdir_stat, mode_exists, mode_isdir, stat_mode from printing import eprint import os argparse_cp = ( add_arg( '-r', '--recursive', dest='recursive', action='store_true', help='Copy directories recursively', default=False ), add_arg( 'filenames', metavar='FILE', nargs='+', help='Pattern or files and directories to copy' ), ) def complete_cp(self, text, line, begidx, endidx): return self.filename_complete(text, line, begidx, endidx) def do_cp(self, line): """cp SOURCE DEST Copy a single SOURCE file to DEST file. cp SOURCE... DIRECTORY Copy multiple SOURCE files to a directory. cp [-r] PATTERN DIRECTORY Copy matching files to DIRECTORY.
from board import BoardError from config import ConfigError from util import add_arg from fileops import cp from printing import cprint, oprint, eprint import printing from ast import literal_eval from tempfile import NamedTemporaryFile from datetime import datetime import os argparse_config = ( add_arg('-u', '--upload', dest='upload', action='store_true', help='upload configuration to board', default=False), add_arg('-d', '--delete', dest='delete', action='store_true', help='delete option', default=False), add_arg('--default', dest='default', action='store_true', help='set default option value', default=False), add_arg('option', metavar='OPTION', nargs='?', help='option name'), add_arg('value', metavar='VALUE', nargs='*', help='option value'),
from util import add_arg from fileops import is_pattern, process_pattern, resolve_path, rm from printing import eprint argparse_rm = ( add_arg('-r', '--recursive', dest='recursive', action='store_true', help='remove directories and their contents recursively', default=False), add_arg('-f', '--force', dest='force', action='store_true', help='ignore nonexistent files and arguments', default=False), add_arg('filename', metavar='FILE', nargs='+', help='Pattern or files and directories to remove'), ) def complete_rm(self, text, line, begidx, endidx): return self.filename_complete(text, line, begidx, endidx) def do_rm(self, line): """rm [-f|--force] FILE... Remove one or more files rm [-f|--force] PATTERN Remove multiple files
from util import add_arg from fileops import auto, is_pattern, resolve_path, validate_pattern, listdir_stat, \ get_stat, stat_mode, stat_mtime, stat_size, mode_exists, mode_isdir from printing import eprint, oprint import printing from fnmatch import fnmatch import shutil import time argparse_ls = ( add_arg('-a', '--all', dest='all', action='store_true', help='do not ignore hidden files', default=False), add_arg('-l', '--long', dest='long', action='store_true', help='use a long listing format', default=False), add_arg('filenames', metavar='FILE', nargs='*', help='Files directories or patterns to list'), ) def complete_ls(self, text, line, begidx, endidx):
from util import add_arg from fileops import resolve_path, rsync from printing import eprint, qprint import argparse argparse_rsync = ( add_arg( '-m', '--mirror', dest='mirror', action='store_true', help="rsync copies all files from SRC_DIR to DST_DIR and deletes files " "on DST_DIR that are not also on SRC_DIR. " "--mirror suppresses these file deletions.", default=False, ), add_arg( '-n', '--dry-run', dest='dry_run', action='store_true', help='Shows what would be done without actually performing any file copies.', default=False ), add_arg( 'src_dst_dir', nargs=argparse.REMAINDER, metavar='SRC_DST_DIR', default='.', help='Source and destination directories' )