summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHartmut Goebel <h.goebel@crazy-compilers.com>2022-06-19 10:26:30 +0200
committerHartmut Goebel <h.goebel@crazy-compilers.com>2022-07-04 16:13:13 +0200
commita3d86b341d361530127c36fbfbf77d638df2c1de (patch)
tree70ca3f1870ed3a390dd98714b731b0177c0d0ec6
parentfdcd0133b2e452ce6e8bfbfc185cf3123c06cbfa (diff)
downloadguix-patches-base-for-series-12975.tar
guix-patches-base-for-series-12975.tar.gz
style: Add option '--list-stylings'.base-for-series-12975
* guix/scripts/style.scm (show-stylings): New procedure. (%options, show-help): Add "--list-stylings". * doc/guix.texi (Invoking guix style): Document "-l".
-rw-r--r--doc/guix.texi4
-rw-r--r--guix/scripts/style.scm11
2 files changed, 15 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index b97ee9fa64..92346ab4ba 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -13993,6 +13993,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 rules 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 ca3853af5e..09937d9e02 100644
--- a/guix/scripts/style.scm
+++ b/guix/scripts/style.scm
@@ -798,15 +798,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"))