Skip to content

Commit

Permalink
hotfix: fix workflows, library & formatting (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
KTrain5169 authored Sep 17, 2024
1 parent 2b60819 commit 1f45753
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ on:
- 'versions/cli_args.py'
- '.github/workflows/build.yml'
- 'requirements.txt'
tags-ignore:
- "v*"
pull_request:
workflow_dispatch:
merge_group:
Expand Down
6 changes: 6 additions & 0 deletions library/TextConverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
import tempfile
import audioread
import soundfile as sf
from art import text2art
from collections import Counter
import random
import qrcode
import barcode
from barcode.writer import ImageWriter


class TextConverter:
Expand Down
15 changes: 8 additions & 7 deletions versions/cli_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ def main():
input_group = parser.add_mutually_exclusive_group(required=True)
input_group.add_argument("--text", nargs="+", help="Text to convert")
input_group.add_argument("--file", help="Path to input file")
parser.add_argument("--shift", type=int, default=3, help="Shift for Caesar cipher")
parser.add_argument("--case", choices=['upper', 'lower'], default='upper', help="Case for case_switch")
parser.add_argument("--save", action="store_true", help="Save the result to history file")
parser.add_argument("--copy", action="store_true", help="Copy the result to clipboard")
parser.add_argument("--shift", type=int, default=3,
help="Shift for Caesar cipher")
parser.add_argument("--case", choices=['upper', 'lower'], default='upper',
help="Case for case_switch")
parser.add_argument("--save", action="store_true",
help="Save the result to history file")
parser.add_argument("--copy", action="store_true",
help="Copy the result to clipboard")
parser.add_argument("--filename", help="Filename for QR code or barcode")

args = parser.parse_args()
Expand Down Expand Up @@ -80,13 +84,10 @@ def main():
print(output)
else:
print(result)

# Optionally save the result
if args.save and args.mode not in ["morse_sound", "qr", "barcode"]:
converter.save_result(result, args.mode)
print(f"Result saved to {converter.history_files[args.mode]}")

# Copy result to clipboard if --copy flag is used and mode is not 'qr', 'barcode', or 'morse_sound'
if args.copy and args.mode not in ['qr', 'barcode', 'morse_sound']:
pyperclip.copy(str(result))
print("Result copied to clipboard")
Expand Down

0 comments on commit 1f45753

Please sign in to comment.