[PATCH] style: Add option '--list-stylings'.

DoneSubmitted by Hartmut Goebel.
Details
2 participants
  • Hartmut Goebel
  • Maxime Devos
Owner
unassigned
Severity
normal
H
H
Hartmut Goebel wrote on 19 Jun 10:37 +0200
(address . guix-patches@gnu.org)
bad30ecc00bc6c29f22dd515068e010064ebf05e.1655627838.git.h.goebel@crazy-compilers.com
* guix/scripts/style.scm (show-stylings): New procedure.
(%options, show-help): Add "--list-stylings".
* doc/guix.texi (Invoking guix style): Document "-l".
---
doc/guix.texi | 4 ++++
guix/scripts/style.scm | 11 +++++++++++
2 files changed, 15 insertions(+)

Toggle diff (48 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 86348fc02c..2768762e62 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -13963,6 +13963,10 @@ The @option{--input-simplification} option described below provides
 fine-grain control over when inputs should be simplified.
 @end table
 
+@item --list-stylings
+@itemx -l
+List and describe the available styling rule and exit.
+
 @item --load-path=@var{directory}
 @itemx -L @var{directory}
 Add @var{directory} to the front of the package module search path
diff --git a/guix/scripts/style.scm b/guix/scripts/style.scm
index 8123570c38..3381a54130 100644
--- a/guix/scripts/style.scm
+++ b/guix/scripts/style.scm
@@ -797,15 +797,26 @@ PACKAGE."
                 (lambda args
                   (show-help)
                   (exit 0)))
+        (option '(#\l "list-stylings") #f #f
+                (lambda args
+                  (show-stylings)
+                  (exit 0)))
         (option '(#\V "version") #f #f
                 (lambda args
                   (show-version-and-exit "guix style")))))
 
+(define (show-stylings)
+  (display (G_ "Available styling rules:\n"))
+  (display (G_ "- format: Format the given package definition(s)\n"))
+  (display (G_ "- inputs: Rewrite package inputs to the “new style”\n")))
+
 (define (show-help)
   (display (G_ "Usage: guix style [OPTION]... [PACKAGE]...
 Update package definitions to the latest style.\n"))
   (display (G_ "
   -S, --styling=RULE     apply RULE, a styling rule"))
+  (display (G_ "
+  -l, --list-stylings   display the list of available style rules"))
   (newline)
   (display (G_ "
   -n, --dry-run          display files that would be edited but do nothing"))
-- 
2.30.4
M
M
Maxime Devos wrote on 19 Jun 11:02 +0200
694cd6a2380b614c595929751b6ecbd25df6fd14.camel@telenet.be
Hartmut Goebel schreef op zo 19-06-2022 om 10:37 [+0200]:
Toggle quote (4 lines)
> +@item --list-stylings
> +@itemx -l
> +List and describe the available styling rule and exit.

Nitpick: ‘styling rule’ -> ‘styling rules’. Otherwie LGTM.

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYq7mHRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7g52AP9KZY1De00woGUW+QM4/3dS+F3/
i5tGgFcOVNkjyEbZLQEAiRE6C/X63kXDGmBRfo4UMVs6n8fRhchIxIeFWzxTLwo=
=gZCq
-----END PGP SIGNATURE-----


H
H
Hartmut Goebel wrote on 4 Jul 16:14 +0200
(address . 56083@debbugs.gnu.org)(name . Maxime Devos)(address . maximedevos@telenet.be)
1627bd5e-b610-6ec1-b816-40fc83bcd594@crazy-compilers.com
Thanks for the review. I fixed it and pushed as
a3d86b341d361530127c36fbfbf77d638df2c1de.

--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
H
H
Hartmut Goebel wrote on 4 Jul 16:17 +0200
(address . 56083-close@debbugs.gnu.org)
d0561d09-1fb0-5a37-aac6-8a7d150f3583@crazy-compilers.com
?
Your comment

This issue is archived.

To comment on this conversation send email to 56083@debbugs.gnu.org