diff options
author | Profpatsch <mail@profpatsch.de> | 2024-03-03 17:15:39 +0100 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2024-03-03 17:22:39 +0100 |
commit | 03ce9742fc6dd47cce89270d863a461e947e1fef (patch) | |
tree | 7c149d378d287e54efb90c3393f3eb489234b234 /tests/aszlig | |
parent | cc1a39da14c4f344a1ab625feb035e9535236d16 (diff) |
pkgs/profpatsch/nman: print all command calls to stderr
Currently still unconditionally. The commands are printed in a syntax that can be directly copied and executed in bash. The pretty-printing code is transformed form this Haskell function: ```haskell -- | Simple escaping for bash words. If they contain anything that’s not ascii chars -- and a bunch of often-used special characters, put the word in single quotes. simpleBashEscape :: Text -> Text simpleBashEscape t = do case Text.find (not . isSimple) t of Just _ -> escapeSingleQuote t Nothing -> t where -- any word that is just ascii characters is simple (no spaces or control characters) -- or contains a few often-used characters like - or . isSimple c = Char.isAsciiLower c || Char.isAsciiUpper c || Char.isDigit c -- These are benign, bash will not interpret them as special characters. || List.elem c ['-', '.', ':', '/'] -- Put the word in single quotes -- If there is a single quote in the word, -- close the single quoted word, add a single quote, open the word again escapeSingleQuote t' = "'" <> Text.replace "'" "'\\''" t' <> "'" ```
Diffstat (limited to 'tests/aszlig')
0 files changed, 0 insertions, 0 deletions