Skip to content

Commit

Permalink
chore: minor improvement to docs generation (#477)
Browse files Browse the repository at this point in the history
Minor fix to the automated doc generation.
  • Loading branch information
IronCore864 authored Aug 13, 2024
1 parent d56c1b8 commit fb61907
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 14 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,24 @@ jobs:
run: |
go fmt ./...
git diff --exit-code
docs:
runs-on: ubuntu-latest

name: Automated docs check
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install tox
run: pip install tox~=4.17

- name: Ensure no CLI reference doc changes
run: |
tox -e commands
git diff --exit-code
working-directory: ./docs
11 changes: 6 additions & 5 deletions docs/generate_command_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def get_all_commands() -> typing.List[typing.Tuple[str, str]]:
)


def get_command_help_output(cmd: typing.List[str]) -> str:
def get_command_help_output(cmd: str) -> str:
# Set a fixed terminal line columns so that the output won't be
# affected by the actual terminal width.
cmd = f"stty cols 80; {cmd}"
Expand Down Expand Up @@ -100,9 +100,10 @@ def create_file_if_not_exist(filepath: str, cmd: str) -> bool:


def generate_help_command_and_output(cmd: str) -> typing.Tuple[str, str]:
help_cmd = ["pebble", "help"] if cmd == "help" else ["pebble", cmd, "--help"]
help_cmd_str = " ".join(help_cmd)
help_cmd_output = get_command_help_output(help_cmd_str).strip()
args = ["help"] if cmd == "help" else [cmd, "--help"]
help_cmd_str = " ".join(["pebble"] + args)
go_run_cmd = " ".join(["go", "run", "../cmd/pebble"] + args)
help_cmd_output = get_command_help_output(go_run_cmd).strip()

output = f"""\
<!-- START AUTOMATED OUTPUT -->
Expand All @@ -112,7 +113,7 @@ def generate_help_command_and_output(cmd: str) -> typing.Tuple[str, str]:
```
<!-- END AUTOMATED OUTPUT -->"""

return help_cmd, output
return help_cmd_str, output


def process_command(cmd: str, description: str):
Expand Down
9 changes: 3 additions & 6 deletions docs/reference/cli-commands/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@ Usage:
The run command starts Pebble and runs the configured environment.
Additional arguments may be provided to the service command with the --args
option, which
must be terminated with ";" unless there are no further program options. These
arguments
are appended to the end of the service command, and replace any default
arguments defined
in the service plan. For example:
option, which must be terminated with ";" unless there are no further program
options. These arguments are appended to the end of the service command, and
replace any default arguments defined in the service plan. For example:
pebble run --args myservice --port 8080 \; --hold
Expand Down
5 changes: 2 additions & 3 deletions docs/reference/cli-commands/warnings.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ Usage:
The warnings command lists the warnings that have been reported to the system.
Once warnings have been listed with 'pebble warnings', 'pebble okay' may be
used to
silence them. A warning that's been silenced in this way will not be listed
again unless it happens again, _and_ a cooldown time has passed.
used to silence them. A warning that's been silenced in this way will not be
listed again unless it happens again, _and_ a cooldown time has passed.
Warnings expire automatically, and once expired they are forgotten.
Expand Down

0 comments on commit fb61907

Please sign in to comment.