Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

An example shelljs-plugin to open a file with its default application

License

NotificationsYou must be signed in to change notification settings

shelljs/plugin-open

Repository files navigation

GitHub Actionsnpmshelljs-plugin

AShellJS plugin for theopen() commandto open a file (or URL) with its default application. This is largely based onopener.

This is designed to imitate theopen command on macOS. Here's theequivalent commands for other systems:

  • macOS

    $ open file.txt# opens in a text editor
  • Linux

    $ xdg-open file.txt# opens in a text editor
  • Windows

    > start file.txt

Installation

$ npm install --save shelljs$ npm install --save shelljs-plugin-open

Usage

ShellJS unofficially has the capacity for plugins (the API is likely to change abit) since v0.7.1. Although wedon't recommend developing for this yet, thisplugin is designed to test that API, and we will adapt it along with changes toShellJS up until official plugin support. To use this plugin, you must useexactly version v0.7.1 (although, eventually this will support v1.0.0+).

To use this plugin in your project, include it like so:

varshell=require('shelljs');require('shelljs-plugin-open');// Ex. usage:shell.open('file.txt');// the plugin is now available!

Supported systems

  • Linux (all variants)
  • macOS
  • Windows

This is supported for Node v0.11+

Writing plugins

If you're interested in taking a look at the current state of the plugin API,take a look atindex.js. This has helpful comments explaining thenecessary boilerplate for writing a plugin. For an example usage of the plugin,take a look attest/test.js.

About

An example shelljs-plugin to open a file with its default application

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp