Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
packaging
apkg
Commits
e864be4c
Commit
e864be4c
authored
Mar 22, 2021
by
Jakub Ružička
Browse files
docs: add new errors.md
Fixes:
#35
parent
7fd3c278
Pipeline
#78469
passed with stages
in 2 minutes and 23 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
docs/__init__.py
View file @
e864be4c
"""
"""
generate docs from apkg code/docstrings using mkdocs-macros-plugin
generate docs from apkg code/docstrings using mkdocs-macros-plugin
"""
"""
import
inspect
from
apkg
import
ex
from
apkg
import
pkgstyle
from
apkg
import
pkgstyle
from
apkg.cli
import
cmd2mod
from
apkg.cli
import
cmd2mod
from
pathlib
import
Path
from
pathlib
import
Path
...
@@ -17,6 +20,7 @@ def define_env(env):
...
@@ -17,6 +20,7 @@ def define_env(env):
"""
"""
env
.
variables
.
pkgstyles
=
pkgstyle
.
PKGSTYLES
env
.
variables
.
pkgstyles
=
pkgstyle
.
PKGSTYLES
env
.
variables
.
new_issue_url
=
APKG_NEW_ISSUE_URL
env
.
variables
.
new_issue_url
=
APKG_NEW_ISSUE_URL
env
.
variables
.
exceptions
=
get_exceptions
()
@
env
.
filter
@
env
.
filter
def
relpath
(
path
):
def
relpath
(
path
):
...
@@ -43,3 +47,12 @@ def define_env(env):
...
@@ -43,3 +47,12 @@ def define_env(env):
modname
=
'apkg.commands.%s'
%
cmd2mod
(
cmd
)
modname
=
'apkg.commands.%s'
%
cmd2mod
(
cmd
)
return
"``` text
\n
$> apkg %s --help
\n\n
%s
\n
```"
%
(
return
"``` text
\n
$> apkg %s --help
\n\n
%s
\n
```"
%
(
cmd
,
mod_doc
(
modname
))
cmd
,
mod_doc
(
modname
))
def
get_exceptions
():
"""
return all apkg exceptions sorted by exit_code
"""
exs
=
[
e
for
_
,
e
in
inspect
.
getmembers
(
ex
,
inspect
.
isclass
)]
exs
.
sort
(
key
=
lambda
x
:
x
.
exit_code
)
return
exs
docs/errors.md
0 → 100644
View file @
e864be4c
# apkg errors
`apkg`
communicates errors using custom exceptions in
{{ 'apkg/ex.py' | file_link }}.
Each exception contains message explaining what went wrong as well as
`exit_code`
to return in case it's raised during CLI run.
A list of all
`apkg`
errors/exceptions with their default error message
sorted by exit code:
{% for e in exceptions %}
### {{ e.__name__}}
```
text
{{ e.msg_fmt }}
```
exit code:
`{{ e.exit_code }}`
{% endfor %}
mkdocs.yml
View file @
e864be4c
...
@@ -9,6 +9,7 @@ nav:
...
@@ -9,6 +9,7 @@ nav:
-
config.md
-
config.md
-
pkgstyles.md
-
pkgstyles.md
-
templates.md
-
templates.md
-
errors.md
markdown_extensions
:
markdown_extensions
:
-
admonition
-
admonition
-
toc
:
-
toc
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment