diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 37b43ef..e1058af 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,6 +2,8 @@ on: push: branches: - main + schedule: + - cron: 0 0 * * 3 jobs: build-completion: @@ -9,10 +11,20 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 + - uses: actions/setup-node@v4 - run: curl -sSf https://rye.astral.sh/get | RYE_INSTALL_OPTION="--yes" bash - run: echo "$HOME/.rye/shims" >> $GITHUB_PATH - run: rye config --set-bool behavior.use-uv=true - run: rye sync + - run: rye lock --update awscli - run: rye run aws configure set plugins.aws_cli_plugin aws_cli_plugin - - run: rye run aws + - name: Build specs + run: rye run aws continue-on-error: true + - uses: withfig/push-to-fig-autocomplete-action@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + autocomplete-spec-name: aws + spec-path: export/ts/aws.ts + specs-folder-path: export/ts/aws + pr-body: Automated PR for latest AWS CLI release diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..f2d4835 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,21 @@ +on: + push: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - run: curl -sSf https://rye.astral.sh/get | RYE_INSTALL_OPTION="--yes" bash + - run: echo "$HOME/.rye/shims" >> $GITHUB_PATH + - run: rye config --set-bool behavior.use-uv=true + - run: rye sync + - run: rye lock --update awscli + - run: rye run ruff check --output-format=github . + - run: rye run aws configure set plugins.aws_cli_plugin aws_cli_plugin + - name: Build specs + run: rye run aws + continue-on-error: true diff --git a/.gitignore b/.gitignore index 57cd986..96ec510 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ __pycache__ export dist .DS_Store +.ruff_cache diff --git a/pyproject.toml b/pyproject.toml index dee3c83..c0f0655 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,9 @@ build-backend = "hatchling.build" [tool.rye] managed = true -dev-dependencies = [] +dev-dependencies = [ + "ruff>=0.4.6", +] [tool.hatch.metadata] allow-direct-references = true diff --git a/src/aws_cli_plugin/__init__.py b/src/aws_cli_plugin/__init__.py index 71f0369..2e1f92b 100644 --- a/src/aws_cli_plugin/__init__.py +++ b/src/aws_cli_plugin/__init__.py @@ -1,6 +1,6 @@ import json import re -import os +import os.path as path from pathlib import Path from awscli.customizations.commands import BasicCommand from awscli.clidriver import ServiceCommand, ServiceOperation @@ -13,21 +13,6 @@ def awscli_initialize(cli): cli.register("building-command-table", read_commands) -def print_args(args): - for argName in args: - arg = args[argName] - argJSON = { - "name": arg.cli_name, - "type": arg.cli_type_name, - "nargs": arg.nargs, - "required": arg.required, - "documentation": arg.documentation, - "suggestions": arg.choices, - } - - # print(arg.cli_name, arg.cli_type_name, arg.nargs, arg.required, arg.documentation, arg.choices) - - def stripHTML(text): return re.sub("<[^<]+?>", "", text).strip() @@ -120,10 +105,10 @@ def getDescription(name, description): if value.filename is not None: trailing_path = value.filename else: - trailing_path = os.path.join(name, "_description" + ".rst") + trailing_path = path.join(name, "_description" + ".rst") root_module = value.root_module - doc_path = os.path.join( - os.path.abspath(os.path.dirname(root_module.__file__)), + doc_path = path.join( + path.abspath(path.dirname(root_module.__file__)), "examples", trailing_path, )