pax_global_header00006660000000000000000000000064135344712770014527gustar00rootroot0000000000000052 comment=003c4c7d6882d029aa8b3e5777716d726894d734 shebang-command-2.0.0/000077500000000000000000000000001353447127700145515ustar00rootroot00000000000000shebang-command-2.0.0/.editorconfig000066400000000000000000000002571353447127700172320ustar00rootroot00000000000000root = true [*] indent_style = tab end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.yml] indent_style = space indent_size = 2 shebang-command-2.0.0/.gitattributes000066400000000000000000000000231353447127700174370ustar00rootroot00000000000000* text=auto eol=lf shebang-command-2.0.0/.gitignore000066400000000000000000000000271353447127700165400ustar00rootroot00000000000000node_modules yarn.lock shebang-command-2.0.0/.npmrc000066400000000000000000000000231353447127700156640ustar00rootroot00000000000000package-lock=false shebang-command-2.0.0/.travis.yml000066400000000000000000000000651353447127700166630ustar00rootroot00000000000000language: node_js node_js: - '12' - '10' - '8' shebang-command-2.0.0/index.js000066400000000000000000000006031353447127700162150ustar00rootroot00000000000000'use strict'; const shebangRegex = require('shebang-regex'); module.exports = (string = '') => { const match = string.match(shebangRegex); if (!match) { return null; } const [path, argument] = match[0].replace(/#! ?/, '').split(' '); const binary = path.split('/').pop(); if (binary === 'env') { return argument; } return argument ? `${binary} ${argument}` : binary; }; shebang-command-2.0.0/license000066400000000000000000000021341353447127700161160ustar00rootroot00000000000000MIT License Copyright (c) Kevin MÃ¥rtensson (github.com/kevva) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. shebang-command-2.0.0/package.json000066400000000000000000000010561353447127700170410ustar00rootroot00000000000000{ "name": "shebang-command", "version": "2.0.0", "description": "Get the command from a shebang", "license": "MIT", "repository": "kevva/shebang-command", "author": { "name": "Kevin MÃ¥rtensson", "email": "kevinmartensson@gmail.com", "url": "github.com/kevva" }, "engines": { "node": ">=8" }, "scripts": { "test": "xo && ava" }, "files": [ "index.js" ], "keywords": [ "cmd", "command", "parse", "shebang" ], "dependencies": { "shebang-regex": "^3.0.0" }, "devDependencies": { "ava": "^2.3.0", "xo": "^0.24.0" } } shebang-command-2.0.0/readme.md000066400000000000000000000007571353447127700163410ustar00rootroot00000000000000# shebang-command [![Build Status](https://travis-ci.org/kevva/shebang-command.svg?branch=master)](https://travis-ci.org/kevva/shebang-command) > Get the command from a shebang ## Install ``` $ npm install shebang-command ``` ## Usage ```js const shebangCommand = require('shebang-command'); shebangCommand('#!/usr/bin/env node'); //=> 'node' shebangCommand('#!/bin/bash'); //=> 'bash' ``` ## API ### shebangCommand(string) #### string Type: `string` String containing a shebang. shebang-command-2.0.0/test.js000066400000000000000000000006731353447127700160740ustar00rootroot00000000000000import test from 'ava'; import shebangCommand from '.'; test('main', t => { t.is(shebangCommand('#!/usr/bin/env node'), 'node'); t.is(shebangCommand('#!/bin/bash'), 'bash'); t.is(shebangCommand('#!/bin/bash -ex'), 'bash -ex'); t.is(shebangCommand('#! /bin/bash'), 'bash'); t.is(shebangCommand('#! /bin/bash -ex'), 'bash -ex'); t.is(shebangCommand('#!/sh'), 'sh'); t.is(shebangCommand('node'), null); t.is(shebangCommand(), null); });