diff --git a/.github/workflows/build_and_release.yml b/.github/workflows/build_and_release.yml new file mode 100644 index 0000000..a34d236 --- /dev/null +++ b/.github/workflows/build_and_release.yml @@ -0,0 +1,28 @@ +name: Release + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v2 + - uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + - name: Install Dependencies + run: poetry install + - name: build the sucker + run: make build + - uses: ncipollo/release-action@v1 + with: + artifacts: "utils" + body: "It's releasin' time" + generateReleaseNotes: true + commit: ${{ GITHUB_SHA }} + token: ${{ secrets.YOUR_GITHUB_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index b6e4761..a44d2af 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,5 @@ dmypy.json # Pyre type checker .pyre/ +setup.py +utils \ No newline at end of file diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/cli.py b/src/cli.py new file mode 100644 index 0000000..22ec457 --- /dev/null +++ b/src/cli.py @@ -0,0 +1,30 @@ +import code +import argparse +import importlib +import sys + +BANNER = """ + . o8o oooo o8o . o8o + .o8 `"' `888 `"' .o8 `"' +oooo oooo .o888oo oooo 888 oooo .o888oo oooo .ooooo. .oooo.o +`888 `888 888 `888 888 `888 888 `888 d88' `88b d88( "8 + 888 888 888 888 888 888 888 888 888ooo888 `"Y88b. + 888 888 888 . 888 888 888 888 . 888 888 .o o. )88b + `V88V"V8P' "888" o888o o888o o888o "888" o888o `Y8bod8P' 8""888P' +""" + +def main(): + parser = argparse.ArgumentParser( + description='Run a specific script by name. If no name is provided, start a REPL.' + ) + parser.add_argument('user_input', type=str, nargs='*', + help='The name of the script that you want to run plus any arguments for that script.') + + args = parser.parse_args() + user_input = args.user_input + if len(user_input) == 0: + code.interact(banner=BANNER, local=locals()) + else: + command_name = user_input.pop(0) + module = importlib.import_module(f"src.commands.{command_name}") + sys.exit(module.main(user_input)) diff --git a/src/commands/__init__.py b/src/commands/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/commands/beautify.py b/src/commands/beautify.py new file mode 100644 index 0000000..1cf364c --- /dev/null +++ b/src/commands/beautify.py @@ -0,0 +1,22 @@ +import string + + +def flip_char(char): + if char in string.ascii_lowercase: + return string.ascii_uppercase[string.ascii_lowercase.find(char)] + else: + return string.ascii_lowercase[string.ascii_uppercase.find(char)] + + +def main(args: list): + message = " ".join(args) + new_beautiful_string = [] + + for num, letter in enumerate(message): + if letter in string.ascii_letters: + if num % 2: + new_beautiful_string.append(flip_char(letter)) + continue + new_beautiful_string.append(letter) + + print("".join(new_beautiful_string)) diff --git a/src/commands/uuid4.py b/src/commands/uuid4.py new file mode 100644 index 0000000..ac0a7ba --- /dev/null +++ b/src/commands/uuid4.py @@ -0,0 +1,6 @@ +"""Generate and print a random UUID4.""" +import uuid + + +def main(*args): + print(uuid.uuid4()) diff --git a/src/poetry2setup.py b/src/poetry2setup.py new file mode 100644 index 0000000..ba1dffc --- /dev/null +++ b/src/poetry2setup.py @@ -0,0 +1,17 @@ +from __future__ import print_function + +from poetry.core.utils._compat import Path +from poetry.core.factory import Factory +from poetry.core.masonry.builders.sdist import SdistBuilder + + +def build_setup_py(): + return SdistBuilder(Factory().create_poetry(Path(".").resolve())).build_setup() + + +def main(): + print(build_setup_py().decode("utf8")) + + +if __name__ == "__main__": + main() \ No newline at end of file