Skip to content

Commit dda037c

Browse files
committed
Do not emulate shell expansions
`~` is expanded by the shell before being passed to the program. Programs don't need to re implement this. Compare: > file ~/.profile /home/fredefox/.profile: ASCII text > file "~/.profile" ~/.profile: cannot open `~/.profile' (No such file or directory) You can test what something expands to with `echo`: > echo ~/.profile /home/fredefox/.profile
1 parent 4bddf34 commit dda037c

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

indexer/src/cli.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,14 @@ const cli = yargs.option('out', {
1616
hidden: false,
1717
})
1818

19-
const normalize = (p: string) => path.normalize(p.replace(/^~/, homedir()))
20-
2119
const main = () => {
2220
const {_: directories, out} = cli.argv
2321

2422
const results: {
2523
name: string
2624
type: TsMorph.Structure
2725
}[] = directories.flatMap(directory =>
28-
Tsearch.findFunctions(normalize(directory), {
26+
Tsearch.findFunctions(directory, {
2927
compilerOptions: {
3028
target: TsMorph.ts.ScriptTarget.ES5,
3129
module: TsMorph.ts.ModuleKind.CommonJS,
@@ -38,11 +36,9 @@ const main = () => {
3836
return
3937
}
4038

41-
const filePath = normalize(out)
42-
43-
writeFileSync(filePath, JSON.stringify(results, null, 2), 'utf-8')
39+
writeFileSync(out, JSON.stringify(results, null, 2), 'utf-8')
4440

45-
console.log(`Types writen to ${filePath}`)
41+
console.log(`Types writen to ${out}`)
4642
}
4743

4844
module.exports = main

0 commit comments

Comments
 (0)