Description
- 🎉 First class Typescript support
- ✨ Fluent API to compose commands
- 🌈 Returns the full result
- 0️⃣ Zero dependencies
- 👌 Maps directly to NirCmd API
yarn add nircmd-fluent
npm install nircmd-fluent
Commands, actions and additional parameters are chained together via a fluent api (with the aid of type inference for typescript users) and executed with a final run()
method call.
All commands are executed asynchronously, returning a native node promise that should be awaited.
Commands are composed as you would read them from the NirCmd command reference. For example:
await NirCmd.win().setsize(300, 200, 1280, 720).title("Notepad").run();
Example bringing the window containing the sequence of characters "Fortnite" to the foreground.
import { NirCmd } from "nircmd-fluent";
(async () => {
let output: string;
try {
output = await NirCmd.win().show().ititle("Fortnite").run();
} catch (error) {
console.error(`Failed to bring window to foreground: ${output}`);
}
console.log(output);
})();
More examples can be found in the examples directory.
There are example implementations for both javascript and typescript.
➜ yarn example
$ ts-node example/index.ts
Example output
yarn test
👤 Jarvis Prestidge jarvisprestidge@gmail.com
- Site: https://jarvisprestidge.io
- Twitter: @jarvisprestidge
- Github: @jarvisprestidge
- LinkedIn: @jarvisprestidge
Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.
Give a ⭐️ if this project helped you!