From ac1acfb9083ce32a772c37b0376c4b8b87bdb265 Mon Sep 17 00:00:00 2001 From: phixxy Date: Thu, 5 Mar 2026 14:28:22 -0800 Subject: [PATCH] added filename arg, removed -o --- skratch.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/skratch.py b/skratch.py index dde8a29..089142c 100755 --- a/skratch.py +++ b/skratch.py @@ -1,5 +1,4 @@ #!/usr/bin/python3 - import sys import os import argparse @@ -64,7 +63,15 @@ def main(): prog='skratch', description='Creates a temp file and opens it in an editor', epilog='Text at the bottom of help') + group = parser.add_mutually_exclusive_group() + + group.add_argument( + "filename", + nargs="?", + help="open file in ~/.skratch", + default=None) + group.add_argument( "-c", help="delete all files", @@ -75,12 +82,6 @@ def main(): help="list files", action="store_true") - group.add_argument( - "-o", - metavar="", - help="open file", - action="store") - parser.add_argument( "-v", help="visual editor", @@ -88,13 +89,9 @@ def main(): args = parser.parse_args() - filename = "skratch-XXXXXX" - editor = get_editor(args.v) - if args.o: run(editor,sk_path,args.o) - elif args.c: delete_all(sk_path) + if args.c: delete_all(sk_path) elif args.l: list_all(sk_path) - else: run(editor,sk_path) + else: run(editor,sk_path, args.filename) main() -