def upgrade(self, upgrades=None, run_post_install=None, skip_post_install=None): """ Calls the :code:`core upgrade` command :param upgrades: A list of cores to upgrade, if None, all cores will be upgraded :type upgrades: list or NoneType :param run_post_install: Force run of post-install scripts :type run_post_install: bool or NoneType :param skip_post_install: Force skip of post-install scripts :type skip_post_install: bool or NoneType :return: The output of the related command :rtype: dict """ if not upgrades: upgrades = [] args = [commands.UPGRADE] args.extend(CommandBase._strip_args(upgrades)) if run_post_install is True: args.append(flags.RUN_POST_INSTALL) if skip_post_install is True: args.append(flags.SKIP_POST_INSTALL) return self._exec(args)
def download(self, downloads): """ Calls the :code:`lib download` command :param downloads: A list of libraries to download :type downloads: list :return: The output of the related command :rtype: dict """ args = [commands.DOWNLOAD] args.extend(CommandBase._strip_args(downloads)) return self._exec(args)
def uninstall(self, uninstalls): """ Calls the :code:`lib uninstall` command :param uninstalls: A list of libraries to uninstall :type uninstalls: list :return: The output of the related command :rtype: dict """ args = [commands.UNINSTALL] args.extend(CommandBase._strip_args(uninstalls)) return self._exec(args)
def set(self, setting_name, values): """ Calls the :code:`config set` command :param setting_name: The name of the setting to set :type setting_name: str :param values: The list of values to set :type values: list :return: The output of the related command :rtype: dict """ args = [commands.SET, CommandBase._strip_arg(setting_name)] args.extend(CommandBase._strip_args(values)) return self._exec(args)
def remove(self, setting_name, values): """ Calls the :code:`config remove` command :param setting_name: The name of the setting from which values will be removed :type setting_name: str :param values: The list of values to remove :type values: list :return: The output of the related command :rtype: dict """ args = [commands.REMOVE, CommandBase._strip_arg(setting_name)] args.extend(CommandBase._strip_args(values)) return self._exec(args)
def install(self, libraries=None, git_urls=None, zip_paths=None): """ Calls the :code:`lib install` command :param libraries: A list of libraries to install :type libraries: list or NoneType :param git_urls: A list of git repositories containing libraries to install :type git_urls: list or NoneType :param zip_paths: A list of paths to zip files to install :type zip_paths: list or NoneType :return: The output of the related command :rtype: dict """ args = [commands.INSTALL] if libraries: args.extend(CommandBase._strip_args(libraries)) if git_urls: args.append(flags.GIT_URL) args.extend(CommandBase._strip_args(git_urls)) if zip_paths: args.append(flags.ZIP_PATH) args.extend(CommandBase._strip_args(zip_paths)) return self._exec(args)
def upgrade(self, upgrades=None): """ Calls the :code:`lib upgrade` command :param upgrades: A list of libraries to upgrade, if None, all libraries will be upgraded :type upgrades: list or NoneType :return: The output of the related command :rtype: dict """ if not upgrades: upgrades = [] args = [commands.UPGRADE] args.extend(CommandBase._strip_args(upgrades)) return self._exec(args)
def __call__(self, config=None, describe=None, discovery_timeout=None, fqbn=None, port=None, protocol=None, quiet=None): """ Calls the :code:`monitor` command :param config: Configuration of the port. :type config: str or NoneType :param describe: Show all the settings of the communication port. :type describe: bool or NoneType :param discovery_timeout: Max time to wait for port discovery, e.g.: 30s, 1m (default 5s) :type discovery_timeout: str or NoneType :param fqbn: Fully Qualified Board Name, e.g.: arduino:avr:uno :type fqbn: str or NoneType :param port: Upload port address, e.g.: COM3 or /dev/ttyACM2 :type port: str or NoneType :param protocol: Upload port protocol, e.g: serial :type protocol: str or NoneType :param quiet: Run in silent mode, show only monitor input and output. :type quiet: bool or NoneType :return: The output of the related command :rtype: dict """ args = [] if config: args.extend([flags.CONFIG, CommandBase._strip_arg(config)]) if describe is True: args.append(flags.DESCRIBE) if discovery_timeout: args.extend([ flags.DISCOVERY_TIMEOUT, CommandBase._strip_args(discovery_timeout) ]) if fqbn: args.extend([flags.FQBN, CommandBase._strip_arg(fqbn)]) if port: args.extend([flags.PORT, CommandBase._strip_arg(port)]) if protocol: args.extend([flags.PROTOCOL, CommandBase._strip_arg(protocol)]) if quiet is True: args.append(flags.QUIET) return self._exec(args)
def search(self, keywords=None, names=None): """ Calls the :code:`lib search` command :param keywords: A list of keywords to use to search, if None, all libraries will show up :type keywords: list or NoneType :param names: Only shows libraries names :type names: bool or NoneType :return: The output of the related command :rtype: dict """ args = [commands.SEARCH] if names is True: args.append(flags.NAMES) if keywords is None: keywords = [] if keywords: args.extend(CommandBase._strip_args(keywords)) return self._exec(args)
def search(self, keywords=None, all=None): """ Calls the :code:`core search` command :param keywords: A list of keywords to use to search, if None, all cores will show up :type keywords: list or NoneType :param all: Shows all available core versions :type all: bool or NoneType :return: The output of the related command :rtype: dict """ args = [commands.SEARCH] if keywords is None: keywords = [] if keywords: args.extend(CommandBase._strip_args(keywords)) if all is True: args.append(flags.ALL) return self._exec(args)
def install(self, installs, run_post_install=None, skip_post_install=None): """ Calls the :code:`core download` command :param installs: A list of cores to install :type installs: list :param run_post_install: Force run of post-install scripts :type run_post_install: bool or NoneType :param skip_post_install: Force skip of post-install scripts :type skip_post_install: bool or NoneType :return: The output of the related command :rtype: dict """ args = [commands.INSTALL] args.extend(CommandBase._strip_args(installs)) if run_post_install is True: args.append(flags.RUN_POST_INSTALL) if skip_post_install is True: args.append(flags.SKIP_POST_INSTALL) return self._exec(args)
def __init__(self, cli_path="arduino-cli", config_file=None, additional_urls=None, log_file=None, log_format=None, log_level=None, no_color=None): """ :param cli_path: The :code:`arduino-cli` command name if available in :code:`$PATH`. Can also be a direct path to the executable :type cli_path: str :param config_file: The path to the :code:`arduino-cli` configuration file to be used :type config_file: str or NoneType :param additional_urls: A list of URLs to custom board definitions files :type additional_urls: list or NoneType :param log_file: A path to a file where logs will be stored :type log_file: str or NoneType :param log_format: The format the logs will use :type log_format: str or NoneType :param log_level: The log level for the log file :type log_level: str or NoneType :param no_color: Disable colored output :type no_color: bool or NoneType """ base_args = [cli_path, flags.FORMAT, ArduinoCliCommand.__FORMAT_JSON] if config_file: base_args.extend( [flags.CONFIG_FILE, CommandBase._strip_arg(config_file)]) if additional_urls: base_args.extend([ flags.ADDITIONAL_URLS, ",".join(CommandBase._strip_args(additional_urls)) ]) if log_file: base_args.extend( [flags.LOG_FILE, CommandBase._strip_arg(log_file)]) if log_format: base_args.extend( [flags.LOG_FORMAT, CommandBase._strip_arg(log_format)]) if log_level: base_args.extend( [flags.LOG_LEVEL, CommandBase._strip_arg(log_level)]) if no_color is True: base_args.append(flags.NO_COLOR) CommandBase.__init__(self, base_args) self.__board = BoardCommand(self._base_args) self.__cache = CacheCommand(self._base_args) self.__compile = CompileCommand(self._base_args) self.__config = ConfigCommand(self._base_args) self.__core = CoreCommand(self._base_args) self.__daemon = DaemonCommand(self._base_args) self.__debug = DebugCommand(self._base_args) self.__lib = LibCommand(self._base_args) self.__sketch = SketchCommand(self._base_args) self.__upload = UploadCommand(self._base_args) self.__version = VersionCommand(self._base_args) self.__burn_bootloader = BurnBootloaderCommand(self._base_args) self.__completion = CompletionCommand(self._base_args) self.__outdated = OutdatedCommand(self._base_args) self.__update = UpdateCommand(self._base_args) self.__upgrade = UpgradeCommand(self._base_args) self.__monitor = MonitorCommand(self._base_args)