~rjarry/dlrepo

dlrepo: cli: new no-print-url option v2 APPLIED

Julien Floret: 1
 cli: new no-print-url option

 1 files changed, 20 insertions(+), 6 deletions(-)
#1387533 .build.yml success
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~rjarry/dlrepo/patches/56375/mbox | git am -3
Learn more about email & git

[PATCH dlrepo v2] cli: new no-print-url option Export this patch

The --no-print-url option allows disabling the printing of the target
URL to stderr.
That option is useful in scripts, where we want actual errors to
pop in stderr, but not "URL:" lines.

Suggested-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Julien Floret <julien.floret@6wind.com>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 dlrepo-cli | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/dlrepo-cli b/dlrepo-cli
index 1396ba80993d..8222ca1b4154 100755
--- a/dlrepo-cli
+++ b/dlrepo-cli
@@ -80,6 +80,14 @@ def main():
        More verbose output.
        """,
    )
    parser.add_argument(
        "--no-print-url",
        dest="print_url",
        action="store_false",
        help="""
        Do not print the target URL.
        """,
    )
    sub = parser.add_subparsers(title="sub-command help", metavar="SUB_COMMAND")
    sub.required = True

@@ -221,7 +229,8 @@ def get_info(args):
    if args.raw_json:
        print(json.dumps(data, indent=2))
    else:
        print("URL: %s" % client.make_url(url), file=sys.stderr)
        if args.print_url:
            print("URL: %s" % client.make_url(url), file=sys.stderr)
        for k, v in data["job"].items():
            if isinstance(v, list):
                v = " ".join(v)
@@ -307,7 +316,8 @@ def get_description(args):
    if args.raw_json:
        print(json.dumps(data, indent=2))
    else:
        print("URL: %s" % client.make_url(url), file=sys.stderr)
        if args.print_url:
            print("URL: %s" % client.make_url(url), file=sys.stderr)
        description = data.get("tag", {}).get("description")
        if description is not None:
            print(description)
@@ -340,7 +350,8 @@ def branches(args):
    if args.raw_json:
        print(json.dumps(data, indent=2))
    else:
        print("URL: %s" % client.make_url(url), file=sys.stderr)
        if args.print_url:
            print("URL: %s" % client.make_url(url), file=sys.stderr)
        if args.verbose:
            out = []
            branch_len = 0
@@ -396,7 +407,8 @@ def tags(args):
    if args.raw_json:
        print(json.dumps(data, indent=2))
    else:
        print("URL: %s" % client.make_url(url), file=sys.stderr)
        if args.print_url:
            print("URL: %s" % client.make_url(url), file=sys.stderr)
        for tag in data["branch"]["tags"]:
            print(tag["name"])

@@ -426,7 +438,8 @@ def jobs(args):
    if args.raw_json:
        print(json.dumps(data, indent=2))
    else:
        print("URL: %s" % client.make_url(url), file=sys.stderr)
        if args.print_url:
            print("URL: %s" % client.make_url(url), file=sys.stderr)
        for job in data["tag"]["jobs"]:
            print(job["name"])

@@ -446,7 +459,8 @@ def status(args):
    if args.raw_json:
        print(json.dumps(data, indent=2))
    else:
        print("URL: %s" % client.make_url(url), file=sys.stderr)
        if args.print_url:
            print("URL: %s" % client.make_url(url), file=sys.stderr)
        print("released=%s" % data["tag"]["released"])
        print("stable=%s" % data["tag"]["stable"])
        print("locked=%s" % data["tag"]["locked"])
-- 
2.39.2
dlrepo/patches/.build.yml: SUCCESS in 43s

[cli: new no-print-url option][0] v2 from [Julien Floret][1]

[0]: https://lists.sr.ht/~rjarry/dlrepo/patches/56375
[1]: mailto:julien.floret@6wind.com

✓ #1387533 SUCCESS dlrepo/patches/.build.yml https://builds.sr.ht/~rjarry/job/1387533
Julien Floret <julien.floret@6wind.com> wrote: