first version

This commit is contained in:
Joe Kaufeld 2022-07-22 15:24:11 -04:00
parent 340dc6de89
commit 6faf40538e
8 changed files with 105 additions and 0 deletions

28
.github/workflows/build_and_release.yml vendored Normal file
View File

@ -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 }}

2
.gitignore vendored
View File

@ -127,3 +127,5 @@ dmypy.json
# Pyre type checker
.pyre/
setup.py
utils

0
src/__init__.py Normal file
View File

30
src/cli.py Normal file
View File

@ -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))

0
src/commands/__init__.py Normal file
View File

22
src/commands/beautify.py Normal file
View File

@ -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))

6
src/commands/uuid4.py Normal file
View File

@ -0,0 +1,6 @@
"""Generate and print a random UUID4."""
import uuid
def main(*args):
print(uuid.uuid4())

17
src/poetry2setup.py Normal file
View File

@ -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()