Skip to content

Allow shjs utility to infer the extension for "filename." #278

@nfischer

Description

@nfischer

Currently, the shjs utility can sometimes infer the file extension of the script name. For example:

$ cat input.js
require('shelljs/global');
echo('Hello world');

$ shjs input.js
Hello world

$ shjs input # .js extension will be inferred
Hello world

$ shjs input. # it'd be nice if the .js extension could be inferred here as well
ShellJS: script not found (input.)

I often find myself writing out simple shelljs scripts and their bash equivalents, and I usually name them similarly (input.js and input.sh respectively, for example). Tab complete will complete up to $ shjs input., so it'd be convenient if shjs would infer that I want to run the .js file.

Since the utility already infers file extensions, this would just be a (perhaps more useful) expansion of that.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions