示例#1
0
import os
from itertools import chain

import configargparse
import yaml

from rich.console import Console
from pyvem._command import Command
from pyvem._config import _PROG, rich_theme
from pyvem._help import Help
from pyvem._logging import get_rich_logger
from pyvem._util import get_confirmation, get_response, resolved_path


_console = Console(theme=rich_theme)
_LOGGER = get_rich_logger(__name__)
_HELP = Help(
    name='config',
    brief=f'Manage the {_PROG} configuration file.',
    synopsis=f'\t{_PROG} config set <key> <value>\n'
             f'\t{_PROG} config get <key>\n'
             f'\t{_PROG} config delete <key>'
             f'\t{_PROG} config list'
             f'\t{_PROG} config edit'
             f'\n\n'
             f'\t[h2]aliases:[/h2] {_PROG} c',
    description='This command provides a means of managing {_PROG}\'s .{_PROG}rc file. This '
                'allows for setting, getting, or updating the contents within the .{_PROG}rc.',
    sub_commands='Config supports the following sub-commands:'
                 '\n\n'
                 '[h2]set[/h2]\n'
示例#2
0
from rich.table import Table
from rich import box

from pyvem._command import Command
from pyvem._config import _PROG, rich_theme
from pyvem._help import Help
from pyvem._editor import SupportedEditorCommands, get_editors
from pyvem._logging import get_rich_logger


_FUZZY_SORT_CONFIDENCE_THRESHOLD = 85
_AVAILABLE_EDITOR_KEYS = SupportedEditorCommands.keys()
_AVAILABLE_EDITOR_VALUES = SupportedEditorCommands.values()

_console = Console(theme=rich_theme)
_LOGGER = get_rich_logger(__name__, console=_console)

_HELP = Help(
    name='outdated',
    brief='Show extensions that can be updated',
    synopsis=f'{_PROG} outdated\n'
             f'{_PROG} outdated [[<extension> ...]]\n'
             f'{_PROG} outdated [[<extension> ...]] [[--<editor>]]\n'
             f'{_PROG} outdated [[--<editor>]]\n'
             f'{_PROG} outdated [[--editors]]\n'
             f'{_PROG} outdated [[--all-editors]]\n\n'
             f'[h2]aliases:[/h2] {_PROG} dated, {_PROG} old\n',
    description='This command will check the VSCode Marketplace to see if any (or, specific) '
                'installed extensions have releases that are newer than the local versions.'
                '\n\n'
                'It also provides the ability to check if any (or, specific) supported code '
示例#3
0
from pyvem._logging import get_rich_logger
from pyvem._curler import CurledRequest
from pyvem._util import dict_from_list_key, human_number_format
from pyvem._models import (ExtensionQueryFilterType, ExtensionQueryFlags,
                           ExtensionQuerySortByTypes)

_MARKETPLACE_BASE_URL = 'https://marketplace.visualstudio.com'
_MARKETPLACE_API_VERSION = '6.0-preview.1'
_MARKETPLACE_DEFAULT_FLAGS = [
    ExtensionQueryFlags.AllAttributes,
    ExtensionQueryFlags.IncludeLatestVersionOnly,
]

_CONSOLE = Console()
_LOGGER = get_rich_logger(__name__, console=_CONSOLE)


class Marketplace():
    """The Marketplace class queries the VSCode Marketplace."""
    def __init__(self, tunnel=None):
        self.tunnel = tunnel
        self.request_curler = CurledRequest()

    def _post(self,
              endpoint: str,
              data: Dict[str, str] = None,
              headers: Dict[str, str] = None):
        """
        Performs a post request to the marketplace gallery.