opencommand
v0.0.0
Published
Universal command to open files, URLs, and applications across platforms
Maintainers
Readme
opencommand
Universal command to open files, URLs, and applications across macOS, Windows, and Linux.
Installation
npm install -g opencommandUsage
CLI
# Open a URL in default browser
opencommand https://google.com
# Open a file with default application
opencommand ./document.pdf
# Open current directory in file manager
opencommand .
# Open with specific application
opencommand -a "Visual Studio Code" .
opencommand --app Safari https://apple.com
# Wait for application to close
opencommand -w ./document.pdfProgrammatic API
const { open } = require('opencommand');
// Open a URL
await open('https://google.com');
// Open a file
await open('./document.pdf');
// Open with specific app
await open('./document.pdf', { app: 'Preview' });
// Wait for app to close
await open('./document.pdf', { wait: true });Features
- Cross-platform: Works on macOS, Windows, and Linux
- Universal: Opens URLs, files, directories, and applications
- Simple: Zero dependencies, lightweight
- Flexible: Use specific applications or defaults
- Promise-based: Async/await support
Platform Support
| Platform | Command Used |
|----------|-------------|
| macOS | open |
| Windows | start |
| Linux | xdg-open |
License
MIT
