Skip to content

Commit d8796f8

Browse files
dev: add config parser for cli
1 parent 1f3b5a8 commit d8796f8

3 files changed

Lines changed: 15 additions & 22 deletions

File tree

src/mkdocs_note/config.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ class MkdocsNoteConfig(Config):
2929
- insert_num: The number of recent notes to insert
3030
"""
3131

32-
notes_template = config_opt.Type(str, default="overrides/templates/default.md")
33-
"""The template of the notes.
34-
"""
35-
3632
# Network Graph Configuration
3733
graph_config = config_opt.Type(
3834
dict,
@@ -48,19 +44,3 @@ class MkdocsNoteConfig(Config):
4844
- name: Node naming strategy ("title" or "file_name")
4945
- debug: Enable debug logging for graph generation
5046
"""
51-
52-
# CLI-specific configuration
53-
supported_extensions = config_opt.Type(list, default=[".md"])
54-
"""List of supported note file extensions.
55-
Used by CLI commands to validate note file types.
56-
"""
57-
58-
exclude_patterns = config_opt.Type(list, default=["index.md", "README.md"])
59-
"""List of filename patterns to exclude from note management.
60-
Files matching these patterns will not be created, moved, or managed by CLI commands.
61-
"""
62-
63-
timestamp_format = config_opt.Type(str, default="%Y-%m-%d %H:%M:%S")
64-
"""Date format string for timestamp output.
65-
Uses Python strftime format codes.
66-
"""

src/mkdocs_note/utils/cli/commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from mkdocs_note.utils.cli import common
88

99
log = get_plugin_logger(__name__)
10-
root_dir = Path("docs")
10+
root_dir = common.get_plugin_config()["notes_root"]
1111

1212

1313
class NewCommand:

src/mkdocs_note/utils/cli/common.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,26 @@
22
Common utilities and data structures for CLI operations.
33
"""
44

5-
from mkdocs.plugins import get_plugin_logger
65
from pathlib import Path
76

7+
from mkdocs.plugins import get_plugin_logger
8+
from mkdocs.config.defaults import MkDocsConfig
9+
10+
from mkdocs_note.plugin import MkdocsNotePlugin as plugin
11+
812

913
log = get_plugin_logger(__name__)
1014

1115

16+
def get_plugin_config() -> MkDocsConfig:
17+
"""Get the plugin configuration.
18+
19+
Returns:
20+
MkdocsNoteConfig: The plugin configuration
21+
"""
22+
return plugin.config
23+
24+
1225
def get_asset_directory(note_path: Path) -> Path:
1326
"""Get the asset directory path for a note file.
1427

0 commit comments

Comments
 (0)