sindresorhus / project-ideas

Need a JavaScript module or looking for ideas? Welcome ✨
544 stars 9 forks source link

Change terminal current working directory in Node.js #89

Open axetroy opened 7 years ago

axetroy commented 7 years ago

I wrote a cli tool to doing something, and I want cd to the other directory when the process exit(not process.chdir, like run cd xx in terminal)

I found a lib robotjs can do it. but got problme in Windows and this module's size is to large for me.

anyone want to create the module or got some better idea?

sindresorhus commented 7 years ago

Node.js scripts can't directly change the current working directory of the terminal. On macOS, you could use AppleScript or JSX to do it. No idea what the equivalent on Windows is though.

fregante commented 4 years ago

JSX JXA

(sorry for some reason this issue was the first of the list, didn't realize it was from 2017)

Richienb commented 4 years ago

iTerm seems to support setting a CWD. See https://github.com/sindresorhus/ansi-escapes#itermsetcwdpath for an implementation.

SiddharthShyniben commented 3 years ago

Anything? I wanted the same thing too...

SiddharthShyniben commented 3 years ago

I found a lib robotjs can do it.

Where @axetroy? I don't see it.