aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMirek Kratochvil <exa.exa@gmail.com>2025-10-12 14:33:15 +0200
committerMirek Kratochvil <exa.exa@gmail.com>2025-10-12 14:33:15 +0200
commitdcf143d55651d792fba2754810036a71ddb7db32 (patch)
treee6e1a8e7e07889578ed15519c03896eef05c1547
parentdc30ac33ec765d476ba3b1f74b91f3d2cbccccf9 (diff)
downloadpatchodon-dcf143d55651d792fba2754810036a71ddb7db32.tar.gz
patchodon-dcf143d55651d792fba2754810036a71ddb7db32.tar.bz2
get args cleanup
-rwxr-xr-xpatchodon.py78
1 files changed, 44 insertions, 34 deletions
diff --git a/patchodon.py b/patchodon.py
index 6f5bd2b..18d5753 100755
--- a/patchodon.py
+++ b/patchodon.py
@@ -130,6 +130,11 @@ def do_post(args):
def do_get(args):
+ # search & resolve the status ID on the instance (if configured)
+ # get context, all replies from the same author as the original status ID
+ # cycle the same for all hashes
+ # verify the full hash
+ # pass to git-am OR throw to a directory
pass
@@ -142,39 +147,39 @@ def main():
cmds = ap.add_subparsers(required=True, dest="command")
- if "POST command":
- post = cmds.add_parser("post")
- if "API token sources":
- group = post.add_mutually_exclusive_group()
- group.add_argument(
- "--debug-api-token",
- help=(
- "specify the API token on command line (not very secure,"
- " good for debugging only)"
- ),
- )
- group.add_argument(
- "-e",
- "--env-api-token",
- action="store_true",
- help="get the API token from environment PATCHODON_API_TOKEN",
- )
-
- post.add_argument(
- "-i",
- "--instance-url",
+ if "API token sources":
+ group = cmds.add_mutually_exclusive_group()
+ group.add_argument(
+ "--debug-api-token",
help=(
- "mastodon instance URL to post to, such as"
- " `https://mastodon.example/'"
+ "specify the API token on command line (not very secure,"
+ " good for debugging only)"
),
)
+ group.add_argument(
+ "-e",
+ "--env-api-token",
+ action="store_true",
+ help="get the API token from environment PATCHODON_API_TOKEN",
+ )
+
+ cmds.add_argument(
+ "-i",
+ "--instance-url",
+ help=(
+ "mastodon instance URL to use, such as `https://mastodon.example/'"
+ ),
+ )
+
+ if "POST command":
+ post = cmds.add_parser("post")
post.add_argument(
"-r",
"--recipient",
default=None,
help=(
"user tag to prepend to all posted statuses (required esp. for"
- " direct sending of statuses))"
+ " direct sending of statuses)"
),
)
post.add_argument(
@@ -182,8 +187,8 @@ def main():
"--subject",
default=None,
help=(
- "start text of the initial post (e.g. to @tag someone and name"
- " the project and topic)"
+ "opening text of the initial post, ideally used to specify the"
+ " target project and patch topic"
),
)
post.add_argument(
@@ -209,7 +214,8 @@ def main():
group = get.add_mutually_exclusive_group()
group.add_argument(
"-a",
- "--am",
+ "--run-git-am",
+ action="store_true",
help=(
"apply the patches immediately with git-am instead of"
" storing them in a directory"
@@ -217,25 +223,29 @@ def main():
)
group.add_argument(
"-C",
- "--out-dir",
+ "--out-prefix",
+ default="./patchodon-",
help=(
- "output the patches into a given directory (by default, `.'"
+ "write the numbered patchfiles to files with a given prefix"
+ " (the default `./patchodon-' will produce files like"
+ " `./patchodon-0001.patch')"
),
)
get.add_argument(
"--overwrite",
action="store_true",
- help="overwrite existing patch files instead of renaming",
+ help="overwrite existing patch files instead of failing",
)
ap.add_argument(
"-c",
"--config",
+ default=os.environ["HOME"] + "/.patchodon.ini",
help=(
- "specify a custom config INI file (it can specify a section"
- " [patchodon] with keys instance_url and api_token), defaults to"
- " `$HOME/.patchodon.ini'; specify /dev/null to avoid reading"
- " configs"
+ "specify a custom config INI file that may specify a section"
+ " [patchodon] with keys instance_url and api_token; defaults to"
+ " `$HOME/.patchodon.ini', specify `/dev/null' to avoid config"
+ " loading"
),
)
args = ap.parse_args()