summaryrefslogtreecommitdiff
path: root/lib/strings.nix (follow)
Commit message (Expand)AuthorAgeFilesLines
* lib/strings.escapeNixIdentifier: quote keywords•••Previously `lib.strings.escapeNixIdentifier "assert"` would return `"assert"`; This is wrong, `assert` is not a valid identifier unless quoted.\ This also fixes `lib.generators.toPretty`: `toPretty {} { "assert" = false; }` would previously return an invalid expression. Shelvacu2026-01-021-1/+19
* docs/lib: Make links to clickable hyperlinksAnton Mosich2025-11-291-2/+2
* docs/lib/strings: wrap command line arguments in quotes and backticksAnton Mosich2025-11-291-10/+10
* docs/lib: use backticks for nix namesAnton Mosich2025-11-291-5/+5
* lib/strings.nix: Fix cmakeOptionType argument order in docs•••Arguments were listed out of order in the documentation. Fixes that. Signed-off-by: Jacob Abel <jacobabel@nullpo.dev> Jacob Abel2025-11-281-3/+3
* treewide: remove deprecated lib functions that had warning for more than 2 yearsAliaksandr2025-10-241-81/+0
* lib/*: fix docs to use "returns" instead of "return" (#442388)Johannes Kirschbauer2025-10-061-4/+4
|\
| * lib/*: fix docs to use "returns" instead of "return"Felix Buehler2025-09-121-4/+4
* | lib: init strings.join (#446278)Robert Hensing2025-10-021-0/+30
|\ \
| * | lib: init strings.joinJohannes Kirschbauer2025-09-271-0/+30
| |/
* / lib: remove optional builtins prefixes from prelude functions•••Remove optional builtins prefixes from prelude functions by running: builtins=( abort baseNameOf break derivation derivationStrict dirOf false fetchGit fetchMercurial fetchTarball fetchTree fromTOML import isNull map null placeholder removeAttrs scopedImport throw toString true ) fd --type file . lib --exec-batch sed --in-place --regexp-extended " s/\<builtins\.($( printf '%s\n' "${builtins[@]}" | paste --delimiter '|' --serial - ))\>/\1/g " nix fmt NAHO2025-09-301-1/+1
|/
* lib: prefer replaceString over replaceStringsGutyina Gergő2025-05-281-1/+1
* lib/strings: init replaceStringGutyina Gergő2025-05-281-0/+35
* lib.strings: init toCamelCaseHeitor Augusto2025-05-111-0/+57
* lib.strings: init splitStringBy (#385643)Pol Dellaiera2025-04-231-0/+91
|\
| * lib.strings: init splitStringByHeitor Augusto2025-04-071-0/+91
* | lib/strings: Zero‐pad hex digits in escapeC•••lib.strings.escapeC produces single‐digit hexadecimal strings for character values ≤ 15, which results in an ambiguity. If the following character is a hex digit, it will be interpreted as being part of the escape sequence. systemd, which also relies on C‐style escape sequences, does not decode single‐digit sequences at all, even if unambiguous. Padding the hexadecimal string with "0" avoids this problem. Mikael Voss2025-04-181-1/+5
* | Merge remote-tracking branch 'upstream/staging-next' into stagingSilvan Mosberger2025-04-021-340/+414
|\|
| * treewide: Format all Nix files•••Format all Nix files using the officially approved formatter, making the CI check introduced in the previous commit succeed: nix-build ci -A fmt.check This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153) of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166). This commit will lead to merge conflicts for a number of PRs, up to an estimated ~1100 (~33%) among the PRs with activity in the past 2 months, but that should be lower than what it would be without the previous [partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537). Merge conflicts caused by this commit can now automatically be resolved while rebasing using the [auto-rebase script](https://github.com/NixOS/nixpkgs/tree/8616af08d915377bd930395f3b700a0e93d08728/maintainers/scripts/auto-rebase). If you run into any problems regarding any of this, please reach out to the [formatting team](https://nixos.org/community/teams/formatting/) by pinging @NixOS/nix-formatting. Silvan Mosberger2025-04-011-340/+413
* | lib.cmakeOptionType: support listTristan Ross2025-03-261-2/+2
|/
* lib/strings: allow CA paths in isStorePathMikael Voss2025-03-051-1/+7
* lib.strings: init toSentenceCaseisabel2025-02-191-0/+36
* lib.strings.concatMapAttrsStringSep: initYueh-Shun Li2024-12-061-0/+37
* treewide: lib.isInOldestRelease -> lib.oldestSupportedReleaseIsAtLeastRobert Hensing2024-10-081-1/+1
* lib.strings.trimWith: Refactor scoping•••I wanted to use this instead of [my ownimplementation](https://github.com/nix-community/pyproject.nix/blob/65d4134/lib/util.nix#L18-L23) and got a small performance regression. adisbladis2024-09-031-3/+4
* lib.cli.escapeShellArg{,s}: Only escape when necessary (#333744)•••These utilities will now leave the string undisturbed if it doesn't need to be quoted (because it doesn't have any special characters). This can help generate nicer-looking command lines. This also transitively improves the output of `lib.toGNUCommandLine` which uses `escapeShellArg` internallyGabriella Gonzalez2024-08-161-4/+12
* Doc: migrate lib.strings to commonmarkJohannes Kirschbauer2024-07-271-564/+2002
* lib.trimWith: Minor doc improvementsSilvan Mosberger2024-07-261-3/+4
* lib.strings: add `trim` and `trimWith`•••`strings.trim` returns a copy of the string with all leading and trailing whitespace removed. `strings.trimWith` does the same thing, but calling code can decide whether to trim the start and/or end of the string. Matt Sturgeon2024-07-251-0/+62
* lib/strings: Add makeIncludePath (#296237)•••* Update strings.nix * Fix typo in docs * Update lib/strings.nix Co-authored-by: lolbinarycat <dogedoge61+github@gmail.com> * Update lib/strings.nix Co-authored-by: lolbinarycat <dogedoge61+github@gmail.com> * Add unit test with strings * Move test to strings * Add unit test with package structure * testMakeIncludePathWithPkgs: use real pkgs * Revert "testMakeIncludePathWithPkgs: use real pkgs" This reverts commit fb1850c069cfb324f3a43323da740a27a11793f3. * Update lib/tests/misc.nix Co-authored-by: lolbinarycat <dogedoge61+github@gmail.com> * Update lib/tests/misc.nix Co-authored-by: Silvan Mosberger <github@infinisil.com> --------- Co-authored-by: lolbinarycat <dogedoge61+github@gmail.com> Co-authored-by: Silvan Mosberger <github@infinisil.com>Florian Richer2024-04-021-0/+12
* lib.toInt/toIntBase10: Make more efficient by hoisting up internal strings in...adisbladis2024-03-031-10/+17
* lib.strings: Remove unneeded polyfill•••Nix 2.3 (the minimum version needed to evaluate Nixpkgs) supports these, so no need to keep them around. Silvan Mosberger2024-02-091-2/+1
* lib: make deprecation warnings consistent•••The deprecation warnings in lib were wildly inconsistent. Different formulations were used in different places for the same meaning. Some warnings used builtins.trace instead of lib.warn, which prevents silencing; one even only had a comment instead. Make everything more uniform. Alois Wohlschlager2024-02-031-2/+2
* Merge pull request #273473 from adisbladis/lib-isConvertibleToString-static-list•••lib.isConvertibleToString: Statically compute types listSilvan Mosberger2023-12-111-2/+4
|\
| * lib.isConvertibleToString: Statically compute types listadisbladis2023-12-111-2/+4
* | lib.cmakeOptionType: Statically compute types listadisbladis2023-12-111-6/+7
|/
* lib.strings: Dont create scopes for getName/getVersion•••We can create the `parse` function in a scope one level up to avoid recomputing it every time. adisbladis2023-12-111-12/+12
* lib.strings: add `replicate`•••`strings.replicate` returns n copies of a string, concatenated into a new string Co-authored-by: Silvan Mosberger <github@infinisil.com> h7x42023-10-311-0/+14
* lib: refactor•••- rename `(enable|with)Feature(As|)` inputs to more descriptive names Anderson Torres2023-10-091-12/+15
* lib: add cmakeOptionType, cmakeBool and cmakeFeatureAnderson Torres2023-09-271-0/+58
* lib.removePrefix: OptimiseSilvan Mosberger2023-08-141-2/+2
* lib: simplify stringToCharactersfigsoda2023-06-221-1/+2
* lib.path.hasPrefix: initSilvan Mosberger2023-06-151-1/+2
* Merge pull request #221204 from tweag/deprecate-paths-to-strings•••lib.strings: Prevent paths as inputs in some functionsSilvan Mosberger2023-04-041-11/+75
|\
| * lib.strings.remove{Prefix,Suffix}: Deprecate for path prefix/suffix arguments•••See also parent commits Silvan Mosberger2023-03-151-5/+23
| * lib.strings.normalizePath: Deprecate for path values•••There's no need to call this function on path data types, and it's confusing with the new lib.path library functions Silvan Mosberger2023-03-151-1/+14
| * lib.strings: Deprecate path prefix/suffix/infix arguments•••lib.{hasPrefix,hasInfix,hasSuffix} would otherwise return an always-false result, which can be very unexpected: nix-repl> lib.strings.hasPrefix ./lib ./lib/meta.nix false Silvan Mosberger2023-03-151-5/+38
* | lib/strings: hide asciiTable•••Since it's an attribute set, the lib function location generating code tries to generate locations for each of the characters... Naïm Favier2023-03-041-2/+2
* | strings: add escapeQuery for url encodingPatrick Widmer2023-03-031-3/+18
|/
* Merge pull request #205557 from ncfavier/concatLines•••lib/strings: add `concatLines`Silvan Mosberger2023-01-311-0/+11
|\