pax_global_header00006660000000000000000000000064127707054470014527gustar00rootroot0000000000000052 comment=01de9b7d355f21e00417650a6fb1eb56321bc23c shebang-command-1.2.0/000077500000000000000000000000001277070544700145525ustar00rootroot00000000000000shebang-command-1.2.0/.editorconfig000066400000000000000000000003471277070544700172330ustar00rootroot00000000000000root = true [*] indent_style = tab end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [{package.json,*.yml}] indent_style = space indent_size = 2 [*.md] trim_trailing_whitespace = false shebang-command-1.2.0/.gitattributes000066400000000000000000000000141277070544700174400ustar00rootroot00000000000000* text=auto shebang-command-1.2.0/.gitignore000066400000000000000000000000151277070544700165360ustar00rootroot00000000000000node_modules shebang-command-1.2.0/.travis.yml000066400000000000000000000000761277070544700166660ustar00rootroot00000000000000language: node_js node_js: - 'stable' - '0.12' - '0.10' shebang-command-1.2.0/index.js000066400000000000000000000005321277070544700162170ustar00rootroot00000000000000'use strict'; var shebangRegex = require('shebang-regex'); module.exports = function (str) { var match = str.match(shebangRegex); if (!match) { return null; } var arr = match[0].replace(/#! ?/, '').split(' '); var bin = arr[0].split('/').pop(); var arg = arr[1]; return (bin === 'env' ? arg : bin + (arg ? ' ' + arg : '') ); }; shebang-command-1.2.0/license000066400000000000000000000021451277070544700161210ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) Kevin Martensson (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-1.2.0/package.json000066400000000000000000000012121277070544700170340ustar00rootroot00000000000000{ "name": "shebang-command", "version": "1.2.0", "description": "Get the command from a shebang", "license": "MIT", "repository": "kevva/shebang-command", "author": { "name": "Kevin Martensson", "email": "kevinmartensson@gmail.com", "url": "github.com/kevva" }, "engines": { "node": ">=0.10.0" }, "scripts": { "test": "xo && ava" }, "files": [ "index.js" ], "keywords": [ "cmd", "command", "parse", "shebang" ], "dependencies": { "shebang-regex": "^1.0.0" }, "devDependencies": { "ava": "*", "xo": "*" }, "xo": { "ignores": [ "test.js" ] } } shebang-command-1.2.0/readme.md000066400000000000000000000010671277070544700163350ustar00rootroot00000000000000# 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 --save 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. ## License MIT © [Kevin Martensson](http://github.com/kevva) shebang-command-1.2.0/test.js000066400000000000000000000004641277070544700160730ustar00rootroot00000000000000import test from 'ava'; import fn from './'; test(t => { t.is(fn('#!/usr/bin/env node'), 'node'); t.is(fn('#!/bin/bash'), 'bash'); t.is(fn('#!/bin/bash -ex'), 'bash -ex') t.is(fn('#! /bin/bash'), 'bash'); t.is(fn('#! /bin/bash -ex'), 'bash -ex'); t.is(fn('#!/sh'), 'sh'); t.is(fn('node'), null); });