Skip to content

Commit

Permalink
Adds option to print version
Browse files Browse the repository at this point in the history
  • Loading branch information
sellorm committed Mar 21, 2023
1 parent ce10814 commit 18287f8
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
MASTER_VERSION := $(shell grep '^version = .*$$' pyproject.toml | awk '{print $$3}')
all: README.md

README.md: README.bashdown bashdown
README.md: README.bashdown
bashdown README.bashdown > README.md

build:
-rm -r ./dist/*
poetry build

tidy:
black bashdown/
pylint bashdown/

test:
python3 -m unittest

version:
sed -i "s/^__version__ = .*$$/__version__ = \"$(MASTER_VERSION)\"/g" bashdown/__init__.py

upload:
twine upload dist/*
publish:
poetry publish
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Processes in-line bash in markdown files
positional arguments:
filename
options:
optional arguments:
-h, --help show this help message and exit
For more information please see the docs
Expand Down
15 changes: 12 additions & 3 deletions bashdown/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import subprocess
import sys

__version__ = "0.4.0"
__version__ = "0.5.0"


def process_content(input_lines):
Expand Down Expand Up @@ -48,16 +48,25 @@ def process_content(input_lines):


def cli_arg_parser(args=None):
"""
Parses cli arguments for the command cli tool
"""
parser = argparse.ArgumentParser(
prog="bashdown",
description="Processes in-line bash in markdown files",
# description="Processes in-line bash in markdown files",
epilog="For more information please see the docs",
)
parser.add_argument("filename")
# group = parser.add_mutually_exclusive_group(required=True)
# group = parser.add_mutually_exclusive_group()
parser.add_argument("filename", help="File to process")
parser.add_argument('-v', '--version', action='version', version= __version__)
return parser.parse_args(args)


def main():
"""
Kicks everything off for the cli tool
"""
args = cli_arg_parser(sys.argv[1:])

with open(args.filename, "r", encoding="utf8") as file:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "bashdown"
version = "0.4.0"
version = "0.5.0"
description = "Executes in-line bash in markdown files"
authors = ["Mark Sellors <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 18287f8

Please sign in to comment.