Skip to content

Commit bc33c12

Browse files
authored
Merge branch 'main' into version-3.4.0
2 parents 683e45a + 0fe8b0c commit bc33c12

File tree

9 files changed

+312
-127
lines changed

9 files changed

+312
-127
lines changed

.github/dependabot.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ updates:
33
- package-ecosystem: "github-actions"
44
directory: "/"
55
schedule:
6-
interval: "monthly"
6+
interval: "weekly"

.github/workflows/publish.yml

+54-34
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,82 @@
1-
# This workflow will upload a Python Package using Twine when a release is created
1+
# This workflow will upload a Python Package using Trusted Publishers automatically when a release is created
22
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
# and https://docs.pypi.org/trusted-publishers/using-a-publisher/.
34

45
name: Upload Python Package
56

67
on:
78
release:
8-
types: [created]
9+
types: [published]
910

1011
jobs:
11-
deploy:
12-
12+
release-build:
1313
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
attestations: write # to upload assets attestation of 'dists' for build provenance
17+
id-token: write # grant additional permission to attestation action to mint the OIDC token permission
18+
1419
steps:
15-
- uses: actions/checkout@v4
20+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1621

1722
- name: Set up Python
18-
uses: actions/setup-python@v5
23+
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
1924
with:
20-
python-version: '3.8'
25+
python-version: '3.9'
2126

2227
- name: Install sphinx toolset
23-
run: >-
24-
python -m
25-
pip install
26-
sphinx
27-
sphinx-argparse
28-
--user
28+
run:
29+
python -m pip install sphinx sphinx-argparse --user
2930

3031
- name: Install tldr dependencies
31-
run: >-
32-
python -m
33-
pip install
34-
-r
35-
requirements.txt
36-
--user
32+
run:
33+
python -m pip install -r requirements.txt --user
3734

3835
- name: Generate the manpage
3936
working-directory: docs
4037
run: make man
4138

42-
- name: Install pep517
43-
run: >-
44-
python -m
45-
pip install
46-
pep517
47-
--user
39+
- name: Install build
40+
run:
41+
python -m pip install build --user
4842

4943
- name: Build a binary wheel and a source tarball
5044
run: >-
51-
python -m
52-
pep517.build
53-
--source
54-
--binary
55-
--out-dir dist/
45+
python -m build
46+
--sdist
47+
--wheel
48+
--outdir dist/
5649
.
5750
58-
- name: Publish package
59-
uses: pypa/gh-action-pypi-publish@release/v1
51+
- name: Attest generated files
52+
uses: actions/attest-build-provenance@c074443f1aee8d4aeeae555aebba3282517141b2 # v2.2.3
53+
with:
54+
subject-path: dist/
55+
56+
- name: Upload release distributions
57+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
6058
with:
61-
user: __token__
62-
password: ${{ secrets.PYPI_PASSWORD }}
59+
name: release-dists
60+
path: dist/
61+
62+
pypi-publish:
63+
runs-on: ubuntu-latest
64+
if: github.repository == 'tldr-pages/tldr-python-client'
65+
needs: ['release-build']
66+
67+
environment:
68+
name: pypi
69+
url: https://pypi.org/project/tldr/
70+
71+
permissions:
72+
id-token: write # Required for accessing OpenID Connect (OIDC) token for PyPI trusted publisher
73+
74+
steps:
75+
- name: Retrieve release distributions
76+
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
77+
with:
78+
name: release-dists
79+
path: dist/
80+
81+
- name: Publish package
82+
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4

.github/workflows/test.yml

+110-20
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@ name: Test
33
on: ['push', 'pull_request']
44

55
jobs:
6-
build:
7-
runs-on: ubuntu-latest
6+
build-linux:
7+
runs-on: ${{ matrix.os }}
88

99
strategy:
1010
matrix:
11-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3.9', 'pypy3.10']
11+
os: ['ubuntu-latest', 'ubuntu-24.04-arm']
12+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', 'pypy3.10', 'pypy3.11']
1213

1314
steps:
14-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1516

1617
- name: Set up Python ${{ matrix.python-version }}
17-
uses: actions/setup-python@v5
18+
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
1819
with:
1920
python-version: ${{ matrix.python-version }}
2021

@@ -24,20 +25,12 @@ jobs:
2425
python3 -m pip install -U pytest pytest-runner flake8
2526
2627
- name: Install sphinx dependencies
27-
run: >-
28-
python3 -m
29-
pip install
30-
sphinx
31-
sphinx-argparse
32-
--user
28+
run:
29+
python3 -m pip install sphinx sphinx-argparse --user
3330

3431
- name: Install tldr dependencies
35-
run: >-
36-
python3 -m
37-
pip install
38-
-r
39-
requirements.txt
40-
--user
32+
run:
33+
python3 -m pip install -r requirements.txt --user
4134

4235
- name: Generate the manpage
4336
working-directory: docs
@@ -53,17 +46,114 @@ jobs:
5346
run: |
5447
python3 -m pip install .
5548
tldr --version
49+
tldr tldr --markdown
50+
51+
build-macos:
52+
runs-on: macos-latest
53+
54+
strategy:
55+
matrix:
56+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', 'pypy3.10', 'pypy3.11']
57+
58+
steps:
59+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
60+
61+
- name: Set up Python ${{ matrix.python-version }}
62+
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
63+
with:
64+
python-version: ${{ matrix.python-version }}
65+
66+
- name: Install developer dependencies
67+
run: |
68+
python3 -m pip install -U pip setuptools
69+
python3 -m pip install -U pytest pytest-runner flake8
70+
71+
- name: Install sphinx dependencies
72+
run: |
73+
python3 -m pip install sphinx sphinx-argparse
74+
echo "$HOME/.local/bin" >> $GITHUB_PATH
75+
76+
- name: Install tldr dependencies
77+
run:
78+
python3 -m pip install -r requirements.txt --user
79+
80+
- name: Generate the manpage
81+
working-directory: docs
82+
run: make man
83+
84+
- name: Lint codebase
85+
run: python3 -m flake8
86+
87+
- name: Run test suite
88+
run: python3 -m pytest tests/
89+
90+
- name: Test tldr cli
91+
run: |
92+
python3 -m pip install .
93+
tldr --version
94+
tldr tldr --markdown
95+
96+
build-windows:
97+
runs-on: windows-latest
98+
99+
strategy:
100+
matrix:
101+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
102+
103+
steps:
104+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
105+
106+
- name: Set up Python ${{ matrix.python-version }}
107+
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
108+
with:
109+
python-version: ${{ matrix.python-version }}
110+
111+
- name: Install developer dependencies
112+
run: |
113+
python3 -m pip install -U pip setuptools
114+
python3 -m pip install -U pytest pytest-runner flake8
115+
116+
- name: Install sphinx dependencies
117+
run: |
118+
python -m pip install sphinx sphinx-argparse --user
119+
120+
- name: Install tldr dependencies
121+
run:
122+
python3 -m pip install -r requirements.txt --user
123+
124+
- name: Generate the manpage
125+
working-directory: docs
126+
run: make man
127+
128+
- name: Lint codebase
129+
run: python3 -m flake8
130+
131+
- name: Run test suite
132+
run: python3 -m pytest tests/
133+
134+
- name: Test tldr cli
135+
run: |
136+
python3 -m pip install .
137+
tldr --version
138+
tldr tldr --markdown
56139
57140
build-snap:
58-
runs-on: ubuntu-latest
141+
runs-on: ${{ matrix.os }}
142+
needs: ['build-linux']
143+
144+
strategy:
145+
matrix:
146+
os: ['ubuntu-latest', 'ubuntu-24.04-arm']
59147

60148
steps:
61149
- uses: actions/checkout@v4
62-
- uses: snapcore/action-build@v1
150+
151+
- uses: canonical/action-build@3bdaa03e1ba6bf59a65f84a751d943d549a54e79 # v1.3.0
63152
id: snapcraft-build
64153
with:
65154
snapcraft-args: "-v"
66-
- uses: actions/upload-artifact@v4
155+
156+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
67157
with:
68158
name: ${{ steps.snapcraft-build.outputs.snap }}
69159
path: ${{ steps.snapcraft-build.outputs.snap }}

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ ENV/
114114
env.bak/
115115
venv.bak/
116116

117+
# direnv
118+
.envrc
119+
.direnv/
120+
117121
# Spyder project settings
118122
.spyderproject
119123
.spyproject

README.md

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# tldr-python-client
22

33
[![PyPI Release](https://img.shields.io/pypi/v/tldr.svg)](https://pypi.python.org/pypi/tldr)
4-
[![Build](https://github.com/tldr-pages/tldr-python-client/workflows/Test/badge.svg?branch=main)](https://github.com/tldr-pages/tldr-python-client/actions?query=branch%3Amain)
4+
[![Test](https://github.com/tldr-pages/tldr-python-client/actions/workflows/test.yml/badge.svg)](https://github.com/tldr-pages/tldr-python-client/actions/workflows/test.yml)
5+
[![CodeQL](https://github.com/tldr-pages/tldr-python-client/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/tldr-pages/tldr-python-client/actions/workflows/github-code-scanning/codeql)
56
[![Snap Release](https://snapcraft.io/tldr/badge.svg)](https://snapcraft.io/tldr)
67

78
Python command-line client for [tldr pages](https://github.com/tldr-pages/tldr).
@@ -43,7 +44,7 @@ sudo snap install tldr
4344

4445
## Usage
4546

46-
```txt
47+
```bash
4748
usage: tldr command [options]
4849

4950
Python command line client for tldr
@@ -57,6 +58,7 @@ options:
5758
--search "KEYWORDS" Search for a specific command from a query
5859
-u, --update, --update_cache
5960
Update the local cache of pages and exit
61+
-k, --clear-cache Delete the local cache of pages and exit
6062
-p PLATFORM, --platform PLATFORM
6163
Override the operating system [android, freebsd, linux, netbsd, openbsd, osx, sunos, windows, common]
6264
-l, --list List all available commands for operating system
@@ -67,6 +69,8 @@ options:
6769
-L LANGUAGE, --language LANGUAGE
6870
Override the default language
6971
-m, --markdown Just print the plain page file.
72+
--short-options Display shortform options over longform
73+
--long-options Display longform options over shortform
7074
--print-completion {bash,zsh,tcsh}
7175
print shell completion script
7276
```
@@ -106,7 +110,11 @@ In order of precedence:
106110
- `$HOME/.cache/tldr`
107111
- `~/.cache/tldr`
108112

109-
If you are experiencing issues with *tldr*, consider deleting the cache files before trying other measures.
113+
If you are experiencing issues with *tldr*, consider deleting the cache files before trying other measures:
114+
115+
```bash
116+
tldr --clear-cache
117+
```
110118

111119
#### Autocomplete
112120

@@ -137,6 +145,10 @@ For networks that sit behind a proxy, it may be necessary to disable SSL verific
137145

138146
will disable SSL certificate inspection. This __should be avoided__ unless absolutely necessary.
139147

148+
Alternatively, It is possible to use a different certificate store/bundle by setting:
149+
150+
- `TLDR_CERT=/path/to/certificates.crt`
151+
140152
### Colors
141153

142154
Values of the `TLDR_COLOR_x` variables may consist of three parts:

0 commit comments

Comments
 (0)