mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 12:53:59 +03:00
Remove some trailing spaces
svn path=/nixpkgs/trunk/; revision=33456
This commit is contained in:
parent
db8f709430
commit
613a8ecaf9
@ -17,7 +17,7 @@ rec {
|
|||||||
# Map a function over a list and concatenate the resulting strings.
|
# Map a function over a list and concatenate the resulting strings.
|
||||||
concatMapStrings = f: list: concatStrings (map f list);
|
concatMapStrings = f: list: concatStrings (map f list);
|
||||||
concatImapStrings = f: list: concatStrings (lib.imap f list);
|
concatImapStrings = f: list: concatStrings (lib.imap f list);
|
||||||
|
|
||||||
|
|
||||||
# Place an element between each element of a list, e.g.,
|
# Place an element between each element of a list, e.g.,
|
||||||
# `intersperse "," ["a" "b" "c"]' returns ["a" "," "b" "," "c"].
|
# `intersperse "," ["a" "b" "c"]' returns ["a" "," "b" "," "c"].
|
||||||
@ -37,7 +37,7 @@ rec {
|
|||||||
# Construct a Unix-style search path consisting of each `subDir"
|
# Construct a Unix-style search path consisting of each `subDir"
|
||||||
# directory of the given list of packages. For example,
|
# directory of the given list of packages. For example,
|
||||||
# `makeSearchPath "bin" ["x" "y" "z"]' returns "x/bin:y/bin:z/bin".
|
# `makeSearchPath "bin" ["x" "y" "z"]' returns "x/bin:y/bin:z/bin".
|
||||||
makeSearchPath = subDir: packages:
|
makeSearchPath = subDir: packages:
|
||||||
concatStringsSep ":" (map (path: path + "/" + subDir) packages);
|
concatStringsSep ":" (map (path: path + "/" + subDir) packages);
|
||||||
|
|
||||||
|
|
||||||
@ -48,13 +48,13 @@ rec {
|
|||||||
|
|
||||||
# Idem for Perl search paths.
|
# Idem for Perl search paths.
|
||||||
makePerlPath = makeSearchPath "lib/perl5/site_perl";
|
makePerlPath = makeSearchPath "lib/perl5/site_perl";
|
||||||
|
|
||||||
|
|
||||||
# Dependening on the boolean `cond', return either the given string
|
# Dependening on the boolean `cond', return either the given string
|
||||||
# or the empty string.
|
# or the empty string.
|
||||||
optionalString = cond: string: if cond then string else "";
|
optionalString = cond: string: if cond then string else "";
|
||||||
|
|
||||||
|
|
||||||
# Determine whether a filename ends in the given suffix.
|
# Determine whether a filename ends in the given suffix.
|
||||||
hasSuffix = ext: fileName:
|
hasSuffix = ext: fileName:
|
||||||
let lenFileName = stringLength fileName;
|
let lenFileName = stringLength fileName;
|
||||||
@ -74,7 +74,7 @@ rec {
|
|||||||
then []
|
then []
|
||||||
else map (p: substring p 1 s) (lib.range 0 (sub l 1));
|
else map (p: substring p 1 s) (lib.range 0 (sub l 1));
|
||||||
|
|
||||||
|
|
||||||
# Manipulate a string charcater by character and replace them by strings
|
# Manipulate a string charcater by character and replace them by strings
|
||||||
# before concatenating the results.
|
# before concatenating the results.
|
||||||
stringAsChars = f: s:
|
stringAsChars = f: s:
|
||||||
@ -82,18 +82,18 @@ rec {
|
|||||||
map f (stringToCharacters s)
|
map f (stringToCharacters s)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
# same as vim escape function.
|
# same as vim escape function.
|
||||||
# Each character contained in list is prefixed by "\"
|
# Each character contained in list is prefixed by "\"
|
||||||
escape = list : string :
|
escape = list : string :
|
||||||
stringAsChars (c: if lib.elem c list then "\\${c}" else c) string;
|
stringAsChars (c: if lib.elem c list then "\\${c}" else c) string;
|
||||||
|
|
||||||
|
|
||||||
# still ugly slow. But more correct now
|
# still ugly slow. But more correct now
|
||||||
# [] for zsh
|
# [] for zsh
|
||||||
escapeShellArg = lib.escape (stringToCharacters "\\ ';$`()|<>\t*[]");
|
escapeShellArg = lib.escape (stringToCharacters "\\ ';$`()|<>\t*[]");
|
||||||
|
|
||||||
|
|
||||||
# replace characters by their substitutes. This function is equivalent to
|
# replace characters by their substitutes. This function is equivalent to
|
||||||
# the `tr' command except that one character can be replace by multiple
|
# the `tr' command except that one character can be replace by multiple
|
||||||
# ones. e.g.,
|
# ones. e.g.,
|
||||||
@ -108,12 +108,12 @@ rec {
|
|||||||
in
|
in
|
||||||
stringAsChars subst s;
|
stringAsChars subst s;
|
||||||
|
|
||||||
|
|
||||||
# Compares strings not requiring context equality
|
# Compares strings not requiring context equality
|
||||||
# Obviously, a workaround but works on all Nix versions
|
# Obviously, a workaround but works on all Nix versions
|
||||||
eqStrings = a: b: (a+(substring 0 0 b)) == ((substring 0 0 a)+b);
|
eqStrings = a: b: (a+(substring 0 0 b)) == ((substring 0 0 a)+b);
|
||||||
|
|
||||||
|
|
||||||
# Cut a string with a separator and produces a list of strings which were
|
# Cut a string with a separator and produces a list of strings which were
|
||||||
# separated by this separator. e.g.,
|
# separated by this separator. e.g.,
|
||||||
# `splitString "." "foo.bar.baz"' returns ["foo" "bar" "baz"].
|
# `splitString "." "foo.bar.baz"' returns ["foo" "bar" "baz"].
|
||||||
@ -138,7 +138,7 @@ rec {
|
|||||||
in
|
in
|
||||||
recurse 0 0;
|
recurse 0 0;
|
||||||
|
|
||||||
|
|
||||||
# return the suffix of the second argument if the first argument match its
|
# return the suffix of the second argument if the first argument match its
|
||||||
# prefix. e.g.,
|
# prefix. e.g.,
|
||||||
# `removePrefix "foo." "foo.bar.baz"' returns "bar.baz".
|
# `removePrefix "foo." "foo.bar.baz"' returns "bar.baz".
|
||||||
@ -152,9 +152,7 @@ rec {
|
|||||||
else
|
else
|
||||||
s;
|
s;
|
||||||
|
|
||||||
|
|
||||||
# Return true iff string v1 denotes a version older than v2.
|
# Return true iff string v1 denotes a version older than v2.
|
||||||
versionOlder = v1: v2: builtins.compareVersions v2 v1 == 1;
|
versionOlder = v1: v2: builtins.compareVersions v2 v1 == 1;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user