[bug#56083] style: Add option '--list-stylings'.
 
Commit Message
  
  
* 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(+)
  
 
Comments
  
  
Hartmut Goebel schreef op zo 19-06-2022 om 10:37 [+0200]:
> +@item --list-stylings
> +@itemx -l
> +List and describe the available styling rule and exit.
Nitpick: ‘styling rule’ -> ‘styling rules’.  Otherwie LGTM.
Greetings,
Maxime.
  
 
  
  
Thanks for the review. I fixed it and pushed as 
a3d86b341d361530127c36fbfbf77d638df2c1de.
  
 
  
@@ -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
@@ -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"))