diff --git a/CHANGELOG.md b/CHANGELOG.md index c078956..b33fb13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +### [0.7.3] - 2024-07-24 +#### Added +- Support for `--version` option in the CLI + ### [0.7.2] - 2024-07-24 #### Added - Aliases for cli options `--system` (`-s`) and `--generate-images` (`-i`) diff --git a/mark/cli.py b/mark/cli.py index 35ad849..66136a0 100644 --- a/mark/cli.py +++ b/mark/cli.py @@ -3,19 +3,32 @@ from mark.llm_request import LLMRequest from mark.markdown_file import MarkdownFile from mark.config import get_config +from importlib.metadata import version, PackageNotFoundError + +try: + package_version = version("mark") +except PackageNotFoundError: + package_version = "unknown" @click.command() -@click.argument('input', type=click.File()) -@click.option('--system', '-s', type=click.STRING, default='default') +@click.argument('file', type=click.File()) +@click.option('--system', '-s', type=click.STRING, default='default', help='The system prompt to use') @click.option('--generate-image', '-i', is_flag=True, default=False, help='EXPERIMENTAL: Generate an image using DALL-E.') -def command(input, system, generate_image): +@click.version_option(version=package_version) +def command(file, system, generate_image): """ - Command line tool that processes an input file with a specified agent to generate and record a response. + Markdown powered LLM CLI - Multi-modal AI text generation tool + + In-document Thread Example: + mark path/to/markdown.md + + stdin Example: + echo "Hello, World!" | mark - """ system_prompt = get_config().system_prompts().get(system, 'default') - markdown_file = MarkdownFile(input) + markdown_file = MarkdownFile(file) request = LLMRequest() \ .with_prompt(markdown_file.content) \ .with_system_message(system_prompt) diff --git a/pyproject.toml b/pyproject.toml index b91d831..b40ea28 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "mark" -version = "0.7.2" +version = "0.7.3" description = "" authors = ["Ryan Elston "] diff --git a/tests/test_scraper.py b/tests/test_scraper.py index 1d5d534..f9be3c8 100644 --- a/tests/test_scraper.py +++ b/tests/test_scraper.py @@ -26,10 +26,11 @@ def test_page_scrape(mock_web_page): assert page.body == '\n\nBasic HTML Page\n\nWelcome to My Page\n' + \ '==================\n\n[Visit Example.com](https://www.example.com)\n\n' + def test_timeout_error_handling(): with patch('mark.scraper._render_page', side_effect=pyppeteer.errors.TimeoutError): page = scraper.get('https://timeout-test.com') assert page.body == 'Timeout while fetching page' assert page.title is None, "Expected no title when a TimeoutError occurs" - assert page.url == 'https://timeout-test.com', "URL should be correct even when timeout occurs" \ No newline at end of file + assert page.url == 'https://timeout-test.com', "URL should be correct even when timeout occurs"