Skip to content

Commit db31cbc

Browse files
authored
Dev docs (#6)
- Add documentation and examples for ptcmd - Add entrypoint decorator for CLI entry points
1 parent faad765 commit db31cbc

43 files changed

Lines changed: 2859 additions & 140 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,56 @@
1-
.PHONY: run install install_all refresh uninstall develop build_dist test coverage coverage_result clean
2-
31
MODULE := ptcmd
42
MODULE_PATH := src/${MODULE}
53
PIP_MODULE := ptcmd
64

75
all: clean test lint build_dist
86
refresh: clean develop test lint
97

8+
.PHONY: run
109
run:
1110
python -m ${MODULE}
1211

12+
.PHONY: build_dist
1313
build_dist:
1414
python -m build
1515

16+
.PHONY: install
1617
install:
1718
pip install .
1819

20+
.PHONY: install_all
1921
install_all:
2022
pip install .[all]
2123

24+
.PHONY: develop
2225
develop:
2326
pip install -e .[dev]
2427

28+
.PHONY: lint
2529
lint:
2630
ruff check ${MODULE_PATH} tests/ --fix
2731

32+
.PHONY: docs
33+
docs:
34+
mkdocs build --clean
35+
36+
.PHONY: test
2837
test:
29-
pytest
38+
python -m pytest
3039

40+
.PHONY: coverage_result
3141
coverage_result:
32-
coverage run --source ${MODULE_PATH} --parallel-mode -m pytest
42+
python -m coverage run --source ${MODULE_PATH} --parallel-mode -m pytest
3343

44+
.PHONY: coverage
3445
coverage: coverage_result
3546
coverage combine
3647
coverage html -i
3748

49+
.PHONY: uninstall
3850
uninstall:
3951
pip uninstall ${PIP_MODULE} -y || true
4052

53+
.PHONY: clean
4154
clean:
4255
rm -rf build
4356
rm -rf dist

docs/.nav.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
nav:
2+
- Overview:
3+
- index.md
4+
- interactive_cli.md
5+
- feature.md
6+
- start.md
7+
- User Guide:
8+
- user_guide/index.md
9+
- user_guide/core.md
10+
- user_guide/command.md
11+
- user_guide/argument.md
12+
- Examples: https://github.com/Visecy/ptcmd/tree/master/examples
13+
- API Reference:
14+
- "api/index.md"
15+
- "api/*"

docs/api/argument.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# ptcmd.argument
2+
3+
::: ptcmd.argument

docs/api/command.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# ptcmd.command
2+
3+
::: ptcmd.command

docs/api/completer.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# ptcmd.completer
2+
3+
::: ptcmd.completer

docs/api/core.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# ptcmd.core
2+
3+
::: ptcmd.core

docs/api/index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# API Reference
2+
3+
- [ptcmd.argument](argument.md)
4+
- [ptcmd.info](info.md)
5+
- [ptcmd.command](command.md)
6+
- [ptcmd.completer](completer.md)
7+
- [ptcmd.core](core.md)

docs/api/index.zh.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# API 参考
2+
3+
> API文档由代码自动生成,不提供翻译
4+
5+
- [ptcmd.argument](argument.md)
6+
- [ptcmd.info](info.md)
7+
- [ptcmd.command](command.md)
8+
- [ptcmd.completer](completer.md)
9+
- [ptcmd.core](core.md)

docs/api/info.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# ptcmd.info
2+
3+
::: ptcmd.info

docs/assets/completion.png

8.57 KB
Loading

0 commit comments

Comments
 (0)