fr-docs 3.4.0__tar.gz → 3.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. {fr_docs-3.4.0 → fr_docs-3.4.1}/LICENSE.md +131 -131
  2. {fr_docs-3.4.0 → fr_docs-3.4.1}/PKG-INFO +2 -2
  3. {fr_docs-3.4.0 → fr_docs-3.4.1}/README.md +47 -47
  4. {fr_docs-3.4.0 → fr_docs-3.4.1}/fr_docs/__init__.py +3 -3
  5. {fr_docs-3.4.0 → fr_docs-3.4.1}/fr_docs/__main__.py +132 -114
  6. {fr_docs-3.4.0 → fr_docs-3.4.1}/fr_docs/build.py +807 -651
  7. {fr_docs-3.4.0 → fr_docs-3.4.1}/fr_docs/config.py +112 -111
  8. {fr_docs-3.4.0 → fr_docs-3.4.1}/fr_docs/config_accessors.py +208 -208
  9. {fr_docs-3.4.0 → fr_docs-3.4.1}/fr_docs/frontmatter.py +36 -36
  10. {fr_docs-3.4.0 → fr_docs-3.4.1}/fr_docs/git.py +235 -214
  11. {fr_docs-3.4.0 → fr_docs-3.4.1}/fr_docs/html_pipeline.py +609 -599
  12. {fr_docs-3.4.0 → fr_docs-3.4.1}/fr_docs/init.py +590 -420
  13. {fr_docs-3.4.0 → fr_docs-3.4.1}/fr_docs/markdown.py +471 -465
  14. {fr_docs-3.4.0 → fr_docs-3.4.1}/fr_docs/search.py +587 -587
  15. fr_docs-3.4.1/fr_docs/slug.py +79 -0
  16. {fr_docs-3.4.0 → fr_docs-3.4.1}/fr_docs/syntax.py +188 -188
  17. {fr_docs-3.4.0 → fr_docs-3.4.1}/fr_docs/template.py +200 -200
  18. fr_docs-3.4.1/fr_docs/update.py +135 -0
  19. {fr_docs-3.4.0 → fr_docs-3.4.1}/fr_docs/utils.py +35 -24
  20. {fr_docs-3.4.0 → fr_docs-3.4.1}/fr_docs.egg-info/PKG-INFO +2 -2
  21. {fr_docs-3.4.0 → fr_docs-3.4.1}/fr_docs.egg-info/SOURCES.txt +1 -0
  22. fr_docs-3.4.1/fr_docs.egg-info/entry_points.txt +2 -0
  23. {fr_docs-3.4.0 → fr_docs-3.4.1}/pyproject.toml +3 -3
  24. fr_docs-3.4.0/fr_docs/slug.py +0 -71
  25. fr_docs-3.4.0/fr_docs.egg-info/entry_points.txt +0 -2
  26. {fr_docs-3.4.0 → fr_docs-3.4.1}/fr_docs.egg-info/dependency_links.txt +0 -0
  27. {fr_docs-3.4.0 → fr_docs-3.4.1}/fr_docs.egg-info/requires.txt +0 -0
  28. {fr_docs-3.4.0 → fr_docs-3.4.1}/fr_docs.egg-info/top_level.txt +0 -0
  29. {fr_docs-3.4.0 → fr_docs-3.4.1}/setup.cfg +0 -0
@@ -1,131 +1,131 @@
1
- # PolyForm Noncommercial License 1.0.0
2
-
3
- <https://polyformproject.org/licenses/noncommercial/1.0.0>
4
-
5
- ## Acceptance
6
-
7
- In order to get any license under these terms, you must agree
8
- to them as both strict obligations and conditions to all
9
- your licenses.
10
-
11
- ## Copyright License
12
-
13
- The licensor grants you a copyright license for the
14
- software to do everything you might do with the software
15
- that would otherwise infringe the licensor's copyright
16
- in it for any permitted purpose. However, you may
17
- only distribute the software according to [Distribution
18
- License](#distribution-license) and make changes or new works
19
- based on the software according to [Changes and New Works
20
- License](#changes-and-new-works-license).
21
-
22
- ## Distribution License
23
-
24
- The licensor grants you an additional copyright license
25
- to distribute copies of the software. Your license
26
- to distribute covers distributing the software with
27
- changes and new works permitted by [Changes and New Works
28
- License](#changes-and-new-works-license).
29
-
30
- ## Notices
31
-
32
- You must ensure that anyone who gets a copy of any part of
33
- the software from you also gets a copy of these terms or the
34
- URL for them above, as well as copies of any plain-text lines
35
- beginning with `Required Notice:` that the licensor provided
36
- with the software. For example:
37
-
38
- > Required Notice: Copyright Yoyodyne, Inc. (<http://example.com>)
39
-
40
- ## Changes and New Works License
41
-
42
- The licensor grants you an additional copyright license to
43
- make changes and new works based on the software for any
44
- permitted purpose.
45
-
46
- ## Patent License
47
-
48
- The licensor grants you a patent license for the software that
49
- covers patent claims the licensor can license, or becomes able
50
- to license, that you would infringe by using the software.
51
-
52
- ## Noncommercial Purposes
53
-
54
- Any noncommercial purpose is a permitted purpose.
55
-
56
- ## Personal Uses
57
-
58
- Personal use for research, experiment, and testing for
59
- the benefit of public knowledge, personal study, private
60
- entertainment, hobby projects, amateur pursuits, or religious
61
- observance, without any anticipated commercial application,
62
- is use for a permitted purpose.
63
-
64
- ## Noncommercial Organizations
65
-
66
- Use by any charitable organization, educational institution,
67
- public research organization, public safety or health
68
- organization, environmental protection organization,
69
- or government institution is use for a permitted purpose
70
- regardless of the source of funding or obligations resulting
71
- from the funding.
72
-
73
- ## Fair Use
74
-
75
- You may have "fair use" rights for the software under the
76
- law. These terms do not limit them.
77
-
78
- ## No Other Rights
79
-
80
- These terms do not allow you to sublicense or transfer any of
81
- your licenses to anyone else, or prevent the licensor from
82
- granting licenses to anyone else. These terms do not imply
83
- any other licenses.
84
-
85
- ## Patent Defense
86
-
87
- If you make any written claim that the software infringes or
88
- contributes to infringement of any patent, your patent license
89
- for the software granted under these terms ends immediately. If
90
- your company makes such a claim, your patent license ends
91
- immediately for work on behalf of your company.
92
-
93
- ## Violations
94
-
95
- The first time you are notified in writing that you have
96
- violated any of these terms, or done anything with the software
97
- not covered by your licenses, your licenses can nonetheless
98
- continue if you come into full compliance with these terms,
99
- and take practical steps to correct past violations, within
100
- 32 days of receiving notice. Otherwise, all your licenses
101
- end immediately.
102
-
103
- ## No Liability
104
-
105
- ***As far as the law allows, the software comes as is, without
106
- any warranty or condition, and the licensor will not be liable
107
- to you for any damages arising out of these terms or the use
108
- or nature of the software, under any kind of legal claim.***
109
-
110
- ## Definitions
111
-
112
- The **licensor** is the individual or entity offering these
113
- terms, and the **software** is the software the licensor makes
114
- available under these terms.
115
-
116
- **You** refers to the individual or entity agreeing to these
117
- terms.
118
-
119
- **Your company** is any legal entity, sole proprietorship,
120
- or other kind of organization that you work for, plus all
121
- organizations that have control over, are under the control of,
122
- or are under common control with that organization. **Control**
123
- means ownership of substantially all the assets of an entity,
124
- or the power to direct its management and policies by vote,
125
- contract, or otherwise. Control can be direct or indirect.
126
-
127
- **Your licenses** are all the licenses granted to you for the
128
- software under these terms.
129
-
130
- **Use** means anything you do with the software requiring one
131
- of your licenses.
1
+ # PolyForm Noncommercial License 1.0.0
2
+
3
+ <https://polyformproject.org/licenses/noncommercial/1.0.0>
4
+
5
+ ## Acceptance
6
+
7
+ In order to get any license under these terms, you must agree
8
+ to them as both strict obligations and conditions to all
9
+ your licenses.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a copyright license for the
14
+ software to do everything you might do with the software
15
+ that would otherwise infringe the licensor's copyright
16
+ in it for any permitted purpose. However, you may
17
+ only distribute the software according to [Distribution
18
+ License](#distribution-license) and make changes or new works
19
+ based on the software according to [Changes and New Works
20
+ License](#changes-and-new-works-license).
21
+
22
+ ## Distribution License
23
+
24
+ The licensor grants you an additional copyright license
25
+ to distribute copies of the software. Your license
26
+ to distribute covers distributing the software with
27
+ changes and new works permitted by [Changes and New Works
28
+ License](#changes-and-new-works-license).
29
+
30
+ ## Notices
31
+
32
+ You must ensure that anyone who gets a copy of any part of
33
+ the software from you also gets a copy of these terms or the
34
+ URL for them above, as well as copies of any plain-text lines
35
+ beginning with `Required Notice:` that the licensor provided
36
+ with the software. For example:
37
+
38
+ > Required Notice: Copyright Yoyodyne, Inc. (<http://example.com>)
39
+
40
+ ## Changes and New Works License
41
+
42
+ The licensor grants you an additional copyright license to
43
+ make changes and new works based on the software for any
44
+ permitted purpose.
45
+
46
+ ## Patent License
47
+
48
+ The licensor grants you a patent license for the software that
49
+ covers patent claims the licensor can license, or becomes able
50
+ to license, that you would infringe by using the software.
51
+
52
+ ## Noncommercial Purposes
53
+
54
+ Any noncommercial purpose is a permitted purpose.
55
+
56
+ ## Personal Uses
57
+
58
+ Personal use for research, experiment, and testing for
59
+ the benefit of public knowledge, personal study, private
60
+ entertainment, hobby projects, amateur pursuits, or religious
61
+ observance, without any anticipated commercial application,
62
+ is use for a permitted purpose.
63
+
64
+ ## Noncommercial Organizations
65
+
66
+ Use by any charitable organization, educational institution,
67
+ public research organization, public safety or health
68
+ organization, environmental protection organization,
69
+ or government institution is use for a permitted purpose
70
+ regardless of the source of funding or obligations resulting
71
+ from the funding.
72
+
73
+ ## Fair Use
74
+
75
+ You may have "fair use" rights for the software under the
76
+ law. These terms do not limit them.
77
+
78
+ ## No Other Rights
79
+
80
+ These terms do not allow you to sublicense or transfer any of
81
+ your licenses to anyone else, or prevent the licensor from
82
+ granting licenses to anyone else. These terms do not imply
83
+ any other licenses.
84
+
85
+ ## Patent Defense
86
+
87
+ If you make any written claim that the software infringes or
88
+ contributes to infringement of any patent, your patent license
89
+ for the software granted under these terms ends immediately. If
90
+ your company makes such a claim, your patent license ends
91
+ immediately for work on behalf of your company.
92
+
93
+ ## Violations
94
+
95
+ The first time you are notified in writing that you have
96
+ violated any of these terms, or done anything with the software
97
+ not covered by your licenses, your licenses can nonetheless
98
+ continue if you come into full compliance with these terms,
99
+ and take practical steps to correct past violations, within
100
+ 32 days of receiving notice. Otherwise, all your licenses
101
+ end immediately.
102
+
103
+ ## No Liability
104
+
105
+ ***As far as the law allows, the software comes as is, without
106
+ any warranty or condition, and the licensor will not be liable
107
+ to you for any damages arising out of these terms or the use
108
+ or nature of the software, under any kind of legal claim.***
109
+
110
+ ## Definitions
111
+
112
+ The **licensor** is the individual or entity offering these
113
+ terms, and the **software** is the software the licensor makes
114
+ available under these terms.
115
+
116
+ **You** refers to the individual or entity agreeing to these
117
+ terms.
118
+
119
+ **Your company** is any legal entity, sole proprietorship,
120
+ or other kind of organization that you work for, plus all
121
+ organizations that have control over, are under the control of,
122
+ or are under common control with that organization. **Control**
123
+ means ownership of substantially all the assets of an entity,
124
+ or the power to direct its management and policies by vote,
125
+ contract, or otherwise. Control can be direct or indirect.
126
+
127
+ **Your licenses** are all the licenses granted to you for the
128
+ software under these terms.
129
+
130
+ **Use** means anything you do with the software requiring one
131
+ of your licenses.
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fr-docs
3
- Version: 3.4.0
3
+ Version: 3.4.1
4
4
  Summary: Fast static documentation generator with search, versioning, and zero-config setup
5
- Author: Omena0
5
+ Author-email: Omena0 <omena0mc@gmail.com>
6
6
  License: # PolyForm Noncommercial License 1.0.0
7
7
 
8
8
  <https://polyformproject.org/licenses/noncommercial/1.0.0>
@@ -1,47 +1,47 @@
1
-
2
- # Fr-docs
3
-
4
- Generate fast, fully featured, modern documentation pages from markdown for GitHub pages and static hosting.
5
-
6
- [![Lint](https://github.com/Omena0/fr-docs/actions/workflows/lint.yml/badge.svg)](https://github.com/Omena0/fr-docs/actions/workflows/lint.yml)
7
- [![Docs](https://github.com/Omena0/fr-docs/actions/workflows/pages.yml/badge.svg)](https://github.com/Omena0/fr-docs/actions/workflows/pages.yml)
8
- [![PyPi](https://github.com/Omena0/fr-docs/actions/workflows/publish.yml/badge.svg)](https://github.com/Omena0/fr-docs/actions/workflows/publish.yml)
9
- [![CodeQL](https://github.com/Omena0/fr-docs/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/Omena0/fr-docs/actions/workflows/github-code-scanning/codeql)
10
-
11
- ## Documentation
12
-
13
- - [Getting Started](https://omena0.dev/fr-docs/)
14
- - [Installation](https://omena0.dev/fr-docs/installation)
15
- - [Quickstart](https://omena0.dev/fr-docs/quickstart)
16
- - [Configuration](https://omena0.dev/fr-docs/config.json)
17
- - [Showcase](https://omena0.dev/fr-docs/showcase)
18
-
19
- ## Overview
20
-
21
- Fr-docs is a generic, configurable documentation builder for Python projects. It converts Markdown source files into a searchable, optimized static HTML site with zero-config setup.
22
-
23
- ### Key Features
24
-
25
- - **Toggleable features**: Disable any features in the config.
26
- - **Search**: Search pages, headers, source code files, or symbols. Fuzzy matching included.
27
- - **Markdown features**: Feature-complete markdown features, including:
28
- - **Code highlighting**: Highlight code blocks with `fastpylight`
29
- - **Copy code blocks**: Copy buttons on multiline code blocks, inline copy code blocks.
30
- - **Tables**: Auto convert markdown tables
31
- - **Frontmatter metadata**: Title and description as optional frontmatter.
32
- - **Hover previews**: Hover a link to see the title and description, hover a code ref to see a code preview.
33
- - **Code references**: Link to a source code files, lines, line ranges, or symbols. Automatically generates a clickable code ref.
34
- - **Custom tags**: Highlight tags such as `[ext]` automatically across the site.
35
- - **Auto versioned**: Automatically switch to older documentation based on github tags.<br>
36
- <sup><sub>(requires site/ to be commited into the repo)</sup></sub>
37
- - **Auto minification**: Minifies HTML, CSS and JS and inlines Critical CSS.
38
- - **Same-origin fonts**: Serve fonts from the same origin. Download once before build, serve forever.
39
- - **Page preloading**: Preload page links for faster browsing.
40
- - **Configurable elements**: Configure project name, icon, copyright, topbar links, etc.
41
-
42
-
43
- ### Projects that use fr-docs
44
-
45
- - [Fr-docs](https://omena0.dev/fr-docs/)
46
- - [PyJavaBridge](https://omena0.dev/PyJavaBridge)
47
- <sub><sup>(Legacy)</sup></sub>
1
+
2
+ # Fr-docs
3
+
4
+ Generate fast, fully featured, modern documentation pages from markdown for GitHub pages and static hosting.
5
+
6
+ [![Lint](https://github.com/Omena0/fr-docs/actions/workflows/lint.yml/badge.svg)](https://github.com/Omena0/fr-docs/actions/workflows/lint.yml)
7
+ [![Docs](https://github.com/Omena0/fr-docs/actions/workflows/pages.yml/badge.svg)](https://github.com/Omena0/fr-docs/actions/workflows/pages.yml)
8
+ [![PyPi](https://github.com/Omena0/fr-docs/actions/workflows/publish.yml/badge.svg)](https://github.com/Omena0/fr-docs/actions/workflows/publish.yml)
9
+ [![CodeQL](https://github.com/Omena0/fr-docs/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/Omena0/fr-docs/actions/workflows/github-code-scanning/codeql)
10
+
11
+ ## Documentation
12
+
13
+ - [Getting Started](https://omena0.dev/fr-docs/)
14
+ - [Installation](https://omena0.dev/fr-docs/installation)
15
+ - [Quickstart](https://omena0.dev/fr-docs/quickstart)
16
+ - [Configuration](https://omena0.dev/fr-docs/config.json)
17
+ - [Showcase](https://omena0.dev/fr-docs/showcase)
18
+
19
+ ## Overview
20
+
21
+ Fr-docs is a generic, configurable documentation builder for Python projects. It converts Markdown source files into a searchable, optimized static HTML site with zero-config setup.
22
+
23
+ ### Key Features
24
+
25
+ - **Toggleable features**: Disable any features in the config.
26
+ - **Search**: Search pages, headers, source code files, or symbols. Fuzzy matching included.
27
+ - **Markdown features**: Feature-complete markdown features, including:
28
+ - **Code highlighting**: Highlight code blocks with `fastpylight`
29
+ - **Copy code blocks**: Copy buttons on multiline code blocks, inline copy code blocks.
30
+ - **Tables**: Auto convert markdown tables
31
+ - **Frontmatter metadata**: Title and description as optional frontmatter.
32
+ - **Hover previews**: Hover a link to see the title and description, hover a code ref to see a code preview.
33
+ - **Code references**: Link to a source code files, lines, line ranges, or symbols. Automatically generates a clickable code ref.
34
+ - **Custom tags**: Highlight tags such as `[ext]` automatically across the site.
35
+ - **Auto versioned**: Automatically switch to older documentation based on github tags.<br>
36
+ <sup><sub>(requires site/ to be commited into the repo)</sup></sub>
37
+ - **Auto minification**: Minifies HTML, CSS and JS and inlines Critical CSS.
38
+ - **Same-origin fonts**: Serve fonts from the same origin. Download once before build, serve forever.
39
+ - **Page preloading**: Preload page links for faster browsing.
40
+ - **Configurable elements**: Configure project name, icon, copyright, topbar links, etc.
41
+
42
+
43
+ ### Projects that use fr-docs
44
+
45
+ - [Fr-docs](https://omena0.dev/fr-docs/)
46
+ - [PyJavaBridge](https://omena0.dev/PyJavaBridge)
47
+ <sub><sup>(Legacy)</sup></sub>
@@ -1,3 +1,3 @@
1
- """fr-docs: Fast static documentation generator with search, versioning, and zero-config setup."""
2
-
3
- __version__ = "1.0.0"
1
+ """fr-docs: Fast static documentation generator with search, versioning, and zero-config setup."""
2
+
3
+ __version__ = "1.0.0"
@@ -1,114 +1,132 @@
1
- """Entry point for fr-docs CLI.
2
-
3
- Usage:
4
- python -m fr_docs build [--production] [--symlink] [--config CONFIG]
5
- fr-docs build [--production] [--symlink] [--config CONFIG]
6
- python -m fr_docs init [DIR] [config]
7
- fr-docs init [DIR] [config]
8
- """
9
-
10
- import argparse
11
- import sys
12
-
13
- from .build import main as build_main
14
- from .init import main as init_main
15
-
16
-
17
- def main() -> None:
18
- parser = argparse.ArgumentParser(
19
- prog="fr-docs",
20
- description="Fast static documentation generator",
21
- )
22
- subparsers = parser.add_subparsers(
23
- dest="command",
24
- help="Available commands",
25
- )
26
-
27
- # Build command
28
- build_parser = subparsers.add_parser(
29
- "build",
30
- help="Build the documentation site",
31
- )
32
- build_parser.add_argument(
33
- "--production",
34
- action="store_true",
35
- help="Rewrite internal links to site-root absolute paths for deployed docs.",
36
- )
37
- build_parser.add_argument(
38
- "--symlink",
39
- action="store_true",
40
- help=(
41
- "Create a {site_prefix}/ symlink dir under site/ so a local "
42
- "production build can be opened in a browser. Off by default: "
43
- "in CI the whole docs/site/ tree is deployed as-is, and a nested "
44
- "fr-docs/ symlink folder would show up as "
45
- "omena0.dev/fr-docs/fr-docs/."
46
- ),
47
- )
48
- build_parser.add_argument(
49
- "--config",
50
- help="Path to the configuration JSON file.",
51
- )
52
-
53
- # Init command
54
- init_parser = subparsers.add_parser(
55
- "init",
56
- help="Initialize a new documentation project",
57
- )
58
- init_parser.add_argument(
59
- "dir",
60
- nargs="?",
61
- default="docs",
62
- help="Directory to initialize (default: docs)",
63
- )
64
- init_parser.add_argument(
65
- "target",
66
- nargs="?",
67
- choices=["config"],
68
- default=None,
69
- help="Initialize only the configuration.",
70
- )
71
-
72
- args = parser.parse_args(sys.argv[1:])
73
-
74
- if args.command == "build":
75
- build_argv: list[str] = []
76
-
77
- if args.production:
78
- build_argv.append("--production")
79
-
80
- if args.symlink:
81
- build_argv.append("--symlink")
82
-
83
- if args.config:
84
- build_argv.extend(["--config", args.config])
85
-
86
- build_main(build_argv)
87
- return
88
-
89
- if args.command == "init":
90
- # `fr-docs init config` means "initialize config in ./docs".
91
- if args.dir == "config" and args.target is None:
92
- init_main("docs", True)
93
- return
94
-
95
- init_main(args.dir, args.target == "config")
96
- return
97
-
98
- # Default to build for backwards compatibility.
99
- if len(sys.argv) > 1 and sys.argv[1] in (
100
- "--production",
101
- "--symlink",
102
- "--config",
103
- "--help",
104
- "-h",
105
- ):
106
- build_main(sys.argv[1:])
107
- return
108
-
109
- parser.print_help()
110
- sys.exit(1)
111
-
112
-
113
- if __name__ == "__main__":
114
- main()
1
+ """Entry point for fr-docs CLI.
2
+
3
+ Usage:
4
+ python -m fr_docs build [--production] [--symlink] [--config CONFIG]
5
+ fr-docs build [--production] [--symlink] [--config CONFIG]
6
+ python -m fr_docs init [DIR] [config|fonts]
7
+ fr-docs init [DIR] [config|fonts]
8
+ """
9
+
10
+ import argparse
11
+ import sys
12
+
13
+ from .build import main as build_main
14
+ from .init import main as init_main
15
+ from .update import main as update_main
16
+
17
+
18
+ def main() -> None:
19
+ parser = argparse.ArgumentParser(
20
+ prog="fr-docs",
21
+ description="Fast static documentation generator",
22
+ )
23
+ subparsers = parser.add_subparsers(
24
+ dest="command",
25
+ help="Available commands",
26
+ )
27
+
28
+ # Build command
29
+ build_parser = subparsers.add_parser(
30
+ "build",
31
+ help="Build the documentation site",
32
+ )
33
+ build_parser.add_argument(
34
+ "--production",
35
+ action="store_true",
36
+ help="Rewrite internal links to site-root absolute paths for deployed docs.",
37
+ )
38
+ build_parser.add_argument(
39
+ "--symlink",
40
+ action="store_true",
41
+ help=(
42
+ "Create a {site_prefix}/ symlink dir under site/ so a local "
43
+ "production build can be opened in a browser. Off by default: "
44
+ "in CI the whole docs/site/ tree is deployed as-is, and a nested "
45
+ "fr-docs/ symlink folder would show up as "
46
+ "omena0.dev/fr-docs/fr-docs/."
47
+ ),
48
+ )
49
+ build_parser.add_argument(
50
+ "--config",
51
+ help="Path to the configuration JSON file.",
52
+ )
53
+
54
+ # Init command
55
+ init_parser = subparsers.add_parser(
56
+ "init",
57
+ help="Initialize a new documentation project",
58
+ )
59
+ init_parser.add_argument(
60
+ "dir",
61
+ nargs="?",
62
+ default="docs",
63
+ help="Directory to initialize (default: docs)",
64
+ )
65
+ init_parser.add_argument(
66
+ "target",
67
+ nargs="?",
68
+ choices=["config", "fonts"],
69
+ default=None,
70
+ help="Initialize only the configuration or download fonts.",
71
+ )
72
+
73
+ # Update command
74
+ update_parser = subparsers.add_parser(
75
+ "update",
76
+ help="Update fr-docs resources (script.js, style.css, fonts) from the repo.",
77
+ )
78
+ update_parser.add_argument(
79
+ "--config",
80
+ help="Path to the configuration JSON file.",
81
+ )
82
+
83
+ args = parser.parse_args(sys.argv[1:])
84
+
85
+ if args.command == "build":
86
+ build_argv: list[str] = []
87
+
88
+ if args.production:
89
+ build_argv.append("--production")
90
+
91
+ if args.symlink:
92
+ build_argv.append("--symlink")
93
+
94
+ if args.config:
95
+ build_argv.extend(["--config", args.config])
96
+
97
+ build_main(build_argv)
98
+ return
99
+
100
+ if args.command == "init":
101
+ # If first arg is "config" or "fonts" with no explicit dir, use current directory
102
+ if args.dir in ("config", "fonts") and args.target is None:
103
+ init_main(".", args.dir)
104
+ return
105
+
106
+ init_main(args.dir, args.target)
107
+ return
108
+
109
+ if args.command == "update":
110
+ update_argv: list[str] = []
111
+ if args.config:
112
+ update_argv.extend(["--config", args.config])
113
+ update_main(update_argv)
114
+ return
115
+
116
+ # Default to build for backwards compatibility.
117
+ if len(sys.argv) > 1 and sys.argv[1] in (
118
+ "--production",
119
+ "--symlink",
120
+ "--config",
121
+ "--help",
122
+ "-h",
123
+ ):
124
+ build_main(sys.argv[1:])
125
+ return
126
+
127
+ parser.print_help()
128
+ sys.exit(1)
129
+
130
+
131
+ if __name__ == "__main__":
132
+ main()