From ac1acfb9083ce32a772c37b0376c4b8b87bdb265 Mon Sep 17 00:00:00 2001 From: phixxy Date: Thu, 5 Mar 2026 14:28:22 -0800 Subject: [PATCH 1/3] 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() - From e851d444710d7073037a5c01c216c3c40a594650 Mon Sep 17 00:00:00 2001 From: phixxy Date: Thu, 5 Mar 2026 14:30:31 -0800 Subject: [PATCH 2/3] changed/removed some text outputs --- skratch.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/skratch.py b/skratch.py index 089142c..9672b16 100755 --- a/skratch.py +++ b/skratch.py @@ -19,7 +19,7 @@ def delete_all(d): for file in files: f = os.path.join(d,file) os.remove(f) - print(f"removing: {f}") + print(f"Removing: {f}") print("Done") def list_all(d): @@ -61,8 +61,7 @@ def main(): parser = argparse.ArgumentParser( prog='skratch', - description='Creates a temp file and opens it in an editor', - epilog='Text at the bottom of help') + description='Creates a temp file and opens it in an editor') group = parser.add_mutually_exclusive_group() From 77f313001ac53d9d81a583f0df93127f98baa222 Mon Sep 17 00:00:00 2001 From: phixxy Date: Thu, 5 Mar 2026 14:33:08 -0800 Subject: [PATCH 3/3] simplified documentation --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2661220..535db84 100644 --- a/README.md +++ b/README.md @@ -15,15 +15,13 @@ set an env variable for $EDITOR and/or $VISUAL in .bashrc export EDITOR=vi export VISUAL=geany - - ## Usage `skratch` creates a random file in .skratch and opens it in the EDITOR -`-c` clears/deletes all files in .skratch +`` opens or creates a file with a specific name in ~/.skratch -`-l` lists files in .skratch +`-c` clears/deletes all files in ~/.skratch -`-o ` opens (or creates) a file with a specific name +`-l` lists files in ~/.skratch -`-v` opens the VISUAL editor +`-v` uses the VISUAL editor