aboutsummaryrefslogtreecommitdiff
path: root/doc/guix.texi
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-01-02 17:29:12 +0100
committerLudovic Courtès <ludo@gnu.org>2022-01-10 14:59:26 +0100
commitc4fe13c294cc1e31dd8a49ce3981f603fb169e0a (patch)
treee5d5136d502ebfdc62e862d0f7b325d5bf86ef2b /doc/guix.texi
parent6f892630ae4726297944fe34b3de4fb608caf66d (diff)
downloadguix-c4fe13c294cc1e31dd8a49ce3981f603fb169e0a.tar.gz
guix-c4fe13c294cc1e31dd8a49ce3981f603fb169e0a.zip
style: Add '--styling' option.
* guix/scripts/style.scm (format-package-definition): New procedure. (%options, show-help): Add "--styling". (%default-options): Add 'styling-procedure'. (guix-style): Honor it. * tests/style.scm (with-test-package) ("input labels, 'safe' policy") ("input labels, 'safe' policy, nothing changed") ("input labels, margin comment") ("input labels, margin comment on long list") ("input labels, line comment") ("input labels, modify-inputs and margin comment"): Pass "-S inputs". * etc/indent-code.el: Remove. * doc/contributing.texi (Formatting Code): Mention "guix style" instead of "etc/indent-code.el". (Submitting Patches): Add item for "guix style". * doc/guix.texi (Invoking guix style): Document "-S" and update.
Diffstat (limited to 'doc/guix.texi')
-rw-r--r--doc/guix.texi60
1 files changed, 51 insertions, 9 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 601212fb45..7ffb0d738c 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -12785,8 +12785,16 @@ otherwise.
The @command{guix style} command helps packagers style their package
definitions according to the latest fashionable trends. The command
-currently focuses on one aspect: the style of package inputs. It may
-eventually be extended to handle other stylistic matters.
+currently provides the providing styling rules:
+
+@itemize
+@item
+formatting package definitions according to the project's conventions
+(@pxref{Formatting Code});
+
+@item
+rewriting package inputs to the ``new style'', as explained below.
+@end itemize
The way package inputs are written is going through a transition
(@pxref{package Reference}, for more on package inputs). Until version
@@ -12817,7 +12825,7 @@ Package Variants}, for more info on @code{modify-inputs}).
In the vast majority of cases, this is a purely mechanical change on the
surface syntax that does not even incur a package rebuild. Running
-@command{guix style} can do that for you, whether you're working on
+@command{guix style -S inputs} can do that for you, whether you're working on
packages in Guix proper or in an external channel.
The general syntax is:
@@ -12827,15 +12835,48 @@ guix style [@var{options}] @var{package}@dots{}
@end example
This causes @command{guix style} to analyze and rewrite the definition
-of @var{package}@dots{}. It does so in a conservative way: preserving
-comments and bailing out if it cannot make sense of the code that
-appears in an inputs field. The available options are listed below.
+of @var{package}@dots{} or, when @var{package} is omitted, of @emph{all}
+the packages. The @option{--styling} or @option{-S} option allows you
+to select the style rule, the default rule being @code{format}---see
+below.
+
+The available options are listed below.
@table @code
@item --dry-run
@itemx -n
Show source file locations that would be edited but do not modify them.
+@item --styling=@var{rule}
+@itemx -S @var{rule}
+Apply @var{rule}, one of the following styling rules:
+
+@table @code
+@item format
+Format the given package definition(s)---this is the default styling
+rule. For example, a packager running Guix on a checkout
+(@pxref{Running Guix Before It Is Installed}) might want to reformat the
+definition of the Coreutils package like so:
+
+@example
+./pre-inst-env guix style coreutils
+@end example
+
+@item inputs
+Rewrite package inputs to the ``new style'', as described above. This
+is how you would rewrite inputs of package @code{whatnot} in your own
+channel:
+
+@example
+guix style -L ~/my/channel -S inputs whatnot
+@end example
+
+Rewriting is done in a conservative way: preserving comments and bailing
+out if it cannot make sense of the code that appears in an inputs field.
+The @option{--input-simplification} option described below provides
+fine-grain control over when inputs should be simplified.
+@end table
+
@item --load-path=@var{directory}
@itemx -L @var{directory}
Add @var{directory} to the front of the package module search path
@@ -12854,9 +12895,10 @@ guix style -e '(@@ (gnu packages gcc) gcc-5)'
styles the @code{gcc-5} package definition.
@item --input-simplification=@var{policy}
-Specify the package input simplification policy for cases where an input
-label does not match the corresponding package name. @var{policy} may
-be one of the following:
+When using the @code{inputs} styling rule, with @samp{-S inputs}, this
+option specifies the package input simplification policy for cases where
+an input label does not match the corresponding package name.
+@var{policy} may be one of the following:
@table @code
@item silent