Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ classifiers = [
"Topic :: Internet :: WWW/HTTP",
]
dependencies = [
"httpx>=1.0.dev6",
"httpx",
"click",
"jinja2",
"markdown",
Expand All @@ -33,5 +33,10 @@ dynamic = ["version"]
[tool.hatch.version]
path = "src/mkdocs/__version__.py"

[dependency-groups]
dev = [
"pytest",
]

[project.scripts]
mkdocs = "mkdocs:cli"
mkdocs = "mkdocs:mkdocs"
4 changes: 2 additions & 2 deletions src/mkdocs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .__version__ import __title__, __version__
from .mkdocs import get_current_page, get_site, link_to, Page, Static, Site, MkDocs, cli
from .mkdocs import get_current_page, get_site, link_to, Page, Static, Site, MkDocs, mkdocs


__all__ = [
Expand All @@ -12,5 +12,5 @@
'Static',
'Site',
'MkDocs',
'cli',
'mkdocs',
]
6 changes: 3 additions & 3 deletions src/mkdocs/mkdocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,20 +310,20 @@ def app(request):
# Command line client...

@click.group()
def cli():
def mkdocs():
if pathlib.Path('mkdocs.yml').exists():
raise Exception('Found mkdocs.yml config, but mkdocs 2.0 pre-release is installed')


@cli.command()
@mkdocs.command()
@click.option('--dir', default='docs', help="Default 'docs'.", type=click.Path(exists=True, file_okay=False, dir_okay=True))
@click.option('--output', default='site', help="Default 'site'.", type=click.Path(file_okay=False, dir_okay=True))
def build(dir, output):
m = MkDocs(dir)
m.build(dir, output)


@cli.command()
@mkdocs.command()
@click.option('--dir', default='docs', help="Default 'docs'.", type=click.Path(exists=True, file_okay=False, dir_okay=True))
def serve(dir):
m = MkDocs(dir)
Expand Down
18 changes: 17 additions & 1 deletion tests/test_mkdocs.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
from click.testing import CliRunner
import mkdocs


def test_mkdocs():
pass
runner = CliRunner()
result = runner.invoke(mkdocs.mkdocs, ['--help'])
assert result.exit_code == 0
assert result.output == (
'Usage: mkdocs [OPTIONS] COMMAND [ARGS]...\n'
'\n'
'Options:\n'
' --help Show this message and exit.\n'
'\n'
'Commands:\n'
' build\n'
' serve\n'
)
Loading