From cd8184dc7c35e66def469b9faeb67a053881f98f Mon Sep 17 00:00:00 2001 From: phixxy Date: Thu, 5 Mar 2026 14:55:45 -0800 Subject: [PATCH 1/2] added -s file suffix --- skratch.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/skratch.py b/skratch.py index 7781734..deedef1 100755 --- a/skratch.py +++ b/skratch.py @@ -39,11 +39,11 @@ def get_editor(use_v): return v return e -def run(editor, sk_path, filename=None): +def run(editor, sk_path, filename=None, f_suffix=""): if not filename: t = time.localtime() filename = f"skratch-{t.tm_year}-{t.tm_mon}-{t.tm_mday}-" - fd, fp = tempfile.mkstemp(prefix=filename, dir=sk_path) + fd, fp = tempfile.mkstemp(prefix=filename, dir=sk_path, suffix=f_suffix) os.close(fd) else: fp = os.path.join(sk_path, filename) @@ -77,6 +77,11 @@ def main(): help="list files", action="store_true") + group.add_argument( + "-s", + help="add suffix", + action="store") + parser.add_argument( "-v", help="visual editor", @@ -87,6 +92,6 @@ def main(): editor = get_editor(args.v) if args.c: delete_all(sk_path) elif args.l: list_all(sk_path) - else: run(editor,sk_path, args.filename) + else: run(editor,sk_path, args.filename, args.s) main() From d49ba30b3510908dc8c997f3860fa74d32a0e925 Mon Sep 17 00:00:00 2001 From: phixxy Date: Thu, 5 Mar 2026 14:55:59 -0800 Subject: [PATCH 2/2] added -s documentation --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 535db84..fd33122 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,8 @@ set an env variable for $EDITOR and/or $VISUAL in .bashrc export EDITOR=vi export VISUAL=geany -## Usage +## Usage: + `skratch` creates a random file in .skratch and opens it in the EDITOR `` opens or creates a file with a specific name in ~/.skratch @@ -24,4 +25,6 @@ set an env variable for $EDITOR and/or $VISUAL in .bashrc `-l` lists files in ~/.skratch +`-s` adds a suffix to the file + `-v` uses the VISUAL editor