Repository navigation
Conversation
Co-authored-by: mathiasrw <1063454+mathiasrw@users.noreply.github.com>
Co-authored-by: mathiasrw <1063454+mathiasrw@users.noreply.github.com>
|
@copilot please see updated descirtion of original issue about the absolutelpath printing |
Co-authored-by: mathiasrw <1063454+mathiasrw@users.noreply.github.com>
Implemented |
| } | ||
| } | ||
|
|
||
| if (undefined !== config.nameDelimiter && null !== config.nameDelimiter) { |
There was a problem hiding this comment.
There seems to be a misunderstanding. If --null then use \n. If config.nameDelimiter treat § €, else use \n
There was a problem hiding this comment.
Fixed in 8150175. nameDelimiter is now set once up front: \0 with --null, the treated custom value with --name-delimiter, otherwise \n.
| if (!config.voidSection) { | ||
| delimiter = delimiter.replace(/§/g, '\\'); | ||
| } | ||
| delimiter = unescapeString(delimiter); | ||
| if (!config.voidEuro) { | ||
| delimiter = delimiter.replace(/€/g, '$'); | ||
| } | ||
| if (!config.voidSection) { | ||
| delimiter = delimiter.replace(/§/g, '\\'); | ||
| } |
There was a problem hiding this comment.
Why are we doing voidSecion twice?
There was a problem hiding this comment.
Fixed in 8150175. § is applied once before unescape (same as the replacement); €/§ run again only in the engine via replacePlaceholders.
| delimiter = delimiter.replace(/§/g, '\\'); | ||
| } | ||
| config.nameDelimiter = delimiter; | ||
| } catch (e) { |
There was a problem hiding this comment.
Why are we putting this in a try catch?
There was a problem hiding this comment.
Kept only around unescapeString, same as the replacement — invalid sequences like \x4 need a clean error instead of a stack trace. Fixed in 8150175.
| const now = new Date(); | ||
|
|
||
| import {outputConfig, step, debug, chat, info, error, die} from './output.ts'; | ||
| import {outputConfig, step, debug, chat, printChangedName, error, die} from './output.ts'; |
There was a problem hiding this comment.
Please dont rename. Its info keep that.
There was a problem hiding this comment.
Fixed in 8150175. Restored info; removed printChangedName.
| return fs.promises | ||
| .writeFile(_file_rr, result, _config_rr.encoding) | ||
| .then(() => info(_file_rr), error); | ||
| .then(() => printChangedName(nameToPrint), error); |
There was a problem hiding this comment.
Fixed in 8150175. Engine calls info(name) again after a successful write.
| // Tracks whether a changed-file name has already been written, so --name-delimiter | ||
| // can separate names without a trailing delimiter after the last one. | ||
| let namePrinted = false; | ||
|
|
There was a problem hiding this comment.
No no no. We make sure we dont process the same file multiple times.
There was a problem hiding this comment.
Fixed in 8150175. Dropped namePrinted. Overlapping globs are deduped in getFilePaths, and info skips a path already reported.
Co-authored-by: mathiasrw <1063454+mathiasrw@users.noreply.github.com>
|
Closing. The quality of this is not where it has to be.
#703 will be done again from scratch on current main, as a small change. |
Breaking change: in-place edits now print changed paths on stdout (one per line), like
grep -l/gofmt -l/prettier --write. stderr is only for errors,--verbose, and--debug.Behavior
--quiet/--quiet-total--output,--output-match, or piped data (nothing written in place)--void-asynckeeps list orderNew flags
--null/-0— NUL after each name (safe for spaces/newlines in paths)--name-delimiter <string>— separator between names, no trailing delimiter; escapes and€/§match the replacementImplementation
printChangedName()insrc/output.tswrites names to stdout;info/chatstay on stderrdoReplacement()insrc/engine.tscalls it after successful writessrc/cli.ts