Coder Social home page Coder Social logo

shx's People

Contributors

ariporad avatar corysimmons avatar deining avatar eteeselink avatar freitagbr avatar greenkeeperio-bot avatar kwonoj avatar levithomason avatar mondeja avatar nfischer avatar pomax avatar scott113341 avatar tomhaines432 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shx's Issues

Add license

If this is going to be MIT licensed, we should add that. If we're opting for the BSD license like shelljs, we should modify package.json and add the appropriate license file.

JS usage?

I only see CLI and npm script usage. Is ShellJS for JS and shx is for CLI?

List usb devices

Hi guys,

What is the way to check the usb devices connected with shelljs?

Can I use libusb?

Thanks in advance, Nicholls

Unable to use in postinstall script on Windows

package.json:

"devDependencies": {
  "shx": "^0.1.4"
},
"scripts": {
  "postinstall": "npm install shx && shx ln -s $(pwd) node_modules/self"
}

Works fine on Linux. On Windows:

node_modules/self was unexpected at this time.

C:\Users\M0on75e1l\node_modules\some>  "C:\Users\M0on75e1l\node_modules\some\node_modules\.bin\\node.exe"  "C:\Users\M0on75e1l\node_modules\some\node_modules\.bin\\..\shx\lib\cli.js" ln -s $(pwd) node_modules/self
npm WARN ENOENT ENOENT: no such file or directory, open 'C:\Users\M0on75e1l\package.json'
npm WARN EPACKAGEJSON M0on75e1l No description
npm WARN EPACKAGEJSON M0on75e1l No repository field.
npm WARN EPACKAGEJSON M0on75e1l No README data
npm WARN EPACKAGEJSON M0on75e1l No license field.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "[email protected]"
npm ERR! node v5.3.0
npm ERR! npm  v3.3.12
npm ERR! code ELIFECYCLE

npm ERR! [email protected] postinstall: `npm install shx && shx ln -s $(pwd) node_modules/self`
npm ERR! Exit status 255
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'npm install shx && shx ln -s $(pwd) node_modules/self'.

Switch to Mocha

Reopening this, since it looks like one of our other issues got closed. I looked into test frameworks a bit more.

  • ava seems awesome, but I'm concerned with its concurrent nature. I'd imagine our tests involve modifying state on disk, so concurrently running tests each modifying disk state could be a big issue. If ava has a good workaround for this (other than the .serial method for every test case, which sounds like a pain), feel free to correct me.
  • mocha is pretty popular, and runs things concurrently. That's a bit slower than ava since it's not in parallel, but should be more than fast enough.
  • rocha seems pretty promising. This is a wrapper on top of mocha (so it's still running tests concurrently), but it runs them in a random order (this makes sure we don't have a dependency between different test cases). If we get a random order that fails, rocha will keep that order until we get the tests to pass (so it's still easy to debug issues). If we're starting from scratch, it should be easy to write tests that don't depend on order.

I don't care too much which framework we use, as long as it works and ties into coverage tools. I'm mostly posting this as a reminder that we need some sort of unit tests.

Generic NUL output redirect

It would be really convenient to have a kind of generic way to redirect output to:

  • /dev/null (unix)
  • NUL (batch)
  • $null (powershell)

I am trying to think about a syntax that would not be too heavy. Maybe an option like --null.
What are your thoughts ?

Commands should accept stdin

Currently, it isn't possible to do something like cat file.txt | shx grep 'foo'. It looks like shx isn't passing stdin along to the ShellJS command (although most commands actually support this).

This is currently blocking my work on shelljs/shelljs#525 (I'd like to replace .exec('grep...') with .exec('shx grep...')).

This should be an easy fix, if someone wants to take it up. Looks like we'll only have to change these lines to call the shelljs function with a different this parameter (see the piping docs).

shx with no args: help message?

An upgrade request: if I run shx with no args (ls, pwd, etc), it would make sense to print out some sort of help messages. List the available commands?

chore: remove lgtm.co

The service appears to have been taken down (see lgtm.co). So we should:

  • remove the hooks for PRs
  • remove the lgtm-related files (.lgtm and MAINTAINERS should be the only ones I think)

"shx cp" does not finish on Unix-Systems

The following command is part of my "postinstall"-routine in package.json:

shx cp node_modules/react/dist/react.min.js node_modules/react-dom/dist/react-dom.min.js node_modules/three/build/three.min.js app/static/

With v0.1.4 everything is working fine, but after updating my dependencies (shx v0.2.0) npm install would not finish on travis or my buddies OSX; while i had no trouble running the script on windows.


Edit:
package.json and other stuff can be found here

Codecov.io repo settings

@ariporad it looks like I don't have complete access to shx. I'm missing the settings tab. Guessing this is why I also cannot setup coverage requirements for PRs. Could you grant me this perm or setup the repo?

What needs done:

  • add repo to codecov.io
  • add PR coverage status / requirement
  • add codecov.yml

Here's the current badge for reference:
codecov

Code coverage badge seems to show for latest (passing) PR, not for master branch

It appears that the code coverage badge shows for the latest PR (that passes CI), not for the latest master branch. I noticed that the badge went up to 84% before merging the last PR. Currently, the latest passing PR and master branch have the same coverage, but this could probably be tested out by creating a fake PR that deletes the tests (0% coverage) and then I believe the badge icon will change.

Fixing this is probably as simple as changing a URL in the README badge.

Initial Discussion and TODOs for 1st release

[NOTE: @nfischer opened this to discuss adding a README, and I'm totally hijacking it. Sorry - @ariporad]

Ok, this issue will serve as the replacement for shelljs/shelljs#244. Feel free to discuss or provide feedback.

Things that need to be done prior to 1st release (which will hopefully be in conjunction with [email protected]):

  • Add README.md
  • Add some tests (I already have a bunch on my local machine, I'll push to github in a sec. - @ariporad)
  • Setup Travis (Need tests first)
  • Pick a license
  • Land shelljs/shelljs#357 (This will make testing a lot easier/better)
  • Land shelljs/shelljs#394
  • ???

echo outputs twice

$ shx echo hello world
hello world
hello world

I think the simplest fix is to check for if we get echo as a function, and not output its return value (since echo already outputs things).

piping from cat seems broken

Hey,

I noticed that a lot of output gets missing when I pipe from shx cat. However, shx cat by itself seems to work fine.

Example:

shx cat src/app/**/*.js > /tmp/output && wc /tmp/output
   15655   41088  460494 /tmp/output

shx cat src/app/**/*.js | wc
    2181    5902   65536

For comparison:

 cat src/app/**/*.js | wc
   15655   41088  460494

I'm running 0.1.4

Consider shx REPL

Was toying with a thin streaming wrapper around the shx function. Would be cool to give this some thought. There is good potential to create a cross platform shell repl:

shx repl

This also raised some issues with how we are accepting argv in shx and parsing them in parseArgs. I'll wait until we get some of the other more fundamental issues/PRs cleared before digging in more.

Leaving this issue here as food for thought, for now.

npm install shx

.. doesn't work. Nor does npm install shelljs expose shx.

How do I do an npm install -D of shx?

cp -r fails after 72 directories (Many files)

Im attempting to copy node_modules to a build directory for packaging into an electron application.

It appears that shx silently fails after 72 items.
I checked to make sure it wasn't hiccuping on the last directory it copied 'history', by deleting 'history'. The next alphabetical directory was then copied but no more. ie I think theres a limit on the number of items that can be copied.

shx mkdir ./build/node_modules && shx cp -r ./src/node_modules/* ./build/node_modules

works fine, but

shx cp -r ./src/node_modules ./build/node_modules

does not, while

cp -r ./src/node_modules ./build/node_modules

works as expected.

Ive tried verbose logging, but it just reprints the command. Could it have anything to do with the ulimit being reached on the device as I know I had issues with that and webpack. The solution was to make webpack only process so many files at a time, as the ulimit couldn't be increased.

Im on OSX.

Executing paths should be supported

I'd like a cross-platform way of executing local executables, e.g. under *nix I can currently:

./local/path/executable

this doesn't work under windows because of the path representation ./.

I was hoping I could run:

shx ./local/path/executable

But that doesn't seem to be supported.

Thanks! Otherwise awesome job!

No rimraf command

The package.json uses a call to rimraf, but this is not available on node 4. Should this be a dev dependency?

chore: add node v7 to CI

v7 is available on nvm now, so we should make sure it's added to CI when possible:

  • Travis
  • Appveyor (not sure if it's available yet)

@levithomason can take this, otherwise I'll get to it in a few days.

cd can't work, so we should output a warning

shx cd can't ever work (a child process can't modify its parent process's working directory, for security reasons). We should output this as a warning, or just make shx cd invalid.

--help should list options

If I run shx -h I don’t see, for example, documentation about --noglob. It’d be helpful if that was documented there for.

I tested in a1faf54 (v0.2.1) and it doesn’t appear to be there.

Using sed

Is it possible to use sed in a npm run command? If so, could an example be provided? #

Command substitution feature

To write reasonably complex cross platform scripts, command substitution helps a ton. As a trivial example in package.json

shx rm $(shx pwd)/node_modules

I'm not familiar with the internals of shx, but it does seem like this could be tricky because it would require starting up potentially many sub-shells.

cp -n should not produce errors if file exists

$> ls
fileA  fileB
$> shx cp -n fileA fileB
cp: dest file already exists: fileB
$> echo $?
130
$> cp -n fileA fileB # no output
$> echo $?
0 # no error

This is annoying when shx cp -n is used in a npm script as the script will then stop.

Add -u flag support for cp

Hello!

It would be great if someone could add -u flag support for cp command.

Right now output is following:

cp: option not recognized: u

Thanks in advance.

Feature request: generic OR

It would be very convenient to have a portable OR operator. I have no idea about the syntax, maybe a --or flag:

$> shx foo --or bar

would execute:

node -e "require('child_process').exec('foo || bar')"

Add plugin support

It would be nice if there was support for incorporating ShellJS plugins into shx, like so:

$ shx open file.txt
$ shx git status # assuming there is a git plugin
$ shx mktemp foo.XXXXXX

Since shx blacklists certain commands, it might be good to have some option when creating the ShellJS plugin about whether it will be exposed to shx. This would also get rid of the need for a literal blacklist, since it would then be redundant.

Broken release: missing runtime dependencies

The latest release for shx is broken. It looks like babel-polyfill should actually be listed as a runtime dependency, not a dev dependency. It appears this is the only one so far.

I would recommend removing the current release (if it's possible to remove) and replacing it with a branch that has the fix.

Also, we should investigate ways to prevent slip-ups like this in the future, if at all possible. No good ideas come to my mind right now, however, since the dev dependencies are required to build the project.

use shx for npm script

I'm curious the possibility if shx could be a better alternative to run npm scripts in platform independent way

Unable to install with npm

I tried to install shx with npm (globaly, locally, as dep, as devDep) both linux and windows machines. But it breaks during linking. It looks like it does not find lib/cli.js (see the log below).

npm install shelljs/shx

npm-debug.log

1095 verbose about to build /tmp/node_modules/shx/node_modules/shelljs
1096 info build /tmp/node_modules/shx/node_modules/shelljs
1097 info linkStuff [email protected]
1098 silly linkStuff [email protected] has /tmp/node_modules/shx/node_modules as its parent node_modules
1099 verbose linkBins [email protected]
1100 verbose link bins [ { shjs: './bin/shjs' },
1100 verbose link bins   '/tmp/node_modules/shx/node_modules/.bin',
1100 verbose link bins   false ]
1101 verbose linkMans [email protected]
1102 verbose rebuildBundles [email protected]
1103 verbose rebuildBundles [ 'glob', 'interpret', 'rechoir' ]
1104 silly gentlyRm /tmp/node_modules/shx/node_modules/.bin/shjs is being purged
1105 verbose gentlyRm don't care about contents; nuking /tmp/node_modules/shx/node_modules/.bin/shjs
1106 info install [email protected]
1107 info postinstall [email protected]
1108 verbose unlock done using /home/kirly/.npm/_locks/shelljs-4afc8c83066b6587.lock for /tmp/node_modules/shx/node_modules/shelljs
1109 verbose about to build /tmp/node_modules/shx
1110 info build /tmp/node_modules/shx
1111 info linkStuff [email protected]
1112 silly linkStuff [email protected] has /tmp/node_modules as its parent node_modules
1113 verbose linkBins [email protected]
1114 verbose link bins [ { shx: 'lib/cli.js' }, '/tmp/node_modules/.bin', false ]
1115 verbose linkMans [email protected]
1116 verbose rebuildBundles [email protected]
1117 verbose rebuildBundles [ '.bin', 'shelljs' ]
1118 verbose unlock done using /home/kirly/.npm/_locks/shx-f2158f07ac2468a2.lock for /tmp/node_modules/shx
1119 verbose stack Error: ENOENT, chmod '/tmp/node_modules/shx/lib/cli.js'
1119 verbose stack     at Error (native)
1120 verbose cwd /tmp
1121 error Linux 3.16.0-4-amd64
1122 error argv "/usr/bin/node" "/usr/bin/npm" "i" "-D" "shelljs/shx"
1123 error node v0.12.8
1124 error npm  v2.14.9
1125 error path /tmp/node_modules/shx/lib/cli.js
1126 error code ENOENT
1127 error errno -2
1128 error enoent ENOENT, chmod '/tmp/node_modules/shx/lib/cli.js'
1128 error enoent This is most likely not a problem with npm itself
1128 error enoent and is related to npm not being able to find a file.
1129 verbose exit [ -2, true ]
1130 verbose unbuild node_modules/shx
1131 info preuninstall [email protected]
1132 info uninstall [email protected]
1133 verbose unbuild rmStuff [email protected] from /tmp/node_modules
1134 silly gentlyRm /tmp/node_modules/.bin/shx is being gently removed
1135 silly gentlyRm verifying /tmp is an npm working directory
1136 silly gentlyRm containing path /tmp is under npm's control, in /tmp
1137 silly gentlyRm deletion target /tmp/node_modules/.bin/shx is under /tmp
1138 verbose gentlyRm vacuuming from /tmp/node_modules/.bin/shx up to /tmp
1139 info postuninstall [email protected]
1140 silly gentlyRm /tmp/node_modules/shx is being purged from base /tmp
1141 verbose gentlyRm don't care about contents; nuking /tmp/node_modules/shx
1142 silly vacuum-fs purging /tmp/node_modules/shx
1143 silly vacuum-fs removing /tmp/node_modules
1144 silly vacuum-fs finished vacuuming up to /tmp

Globbing arguments to an external command

One annoying difference between Windows' old shell and the Unix shell is the lack of globbing on Windows. shx already addresses this for shell builtins and coreutils by including globbing logic in each of the commands' implementations, but this still leaves external commands that weren't written with Windows in mind (and thus don't implement their own globbing) out in the cold.
Would you be open to a PR that adds a feature which simply globs all its arguments and runs the result?
For example, shx XXX foo * would be equivalent to foo * in a Unix shell.
As for naming, command (like the bash builtin) might be an option. Or glob. Or whatever; I'm not picky about the name.

Switch this to use shelljs as a git submodule (for now)

Since we're planning to release this with v0.7, it makes more sense to have shelljs included as a submodule (since master is most of the way to v0.7).

Once v0.7 lands, we can swap out the submodule for a regular npm dependency. If all the tests pass, we can release it.

feature request: --version

It'd be handy to add --version to the shx binary:

$ shx --version
0.2.2

This is handy when using shx globally (which is the easiest way of reproducing bugs).

Add testing and continuous integration

This should have some basic unit tests (maybe one for each command, borrowed from shelljs's unit tests?). This should also get some sort of CI set up, as soon as the unit tests are written.

Add "true" and "false" commands

I think it would be helpful to add the unix true and false commands to shx. I don't know if these should be added to ShellJS itself, or simply parsed out and interpreted directly in shx, though I think I'd lean toward the latter.

sed does not accept a blank replacement string

After upgrading to shx 0.2.1, i.e. a version with the fixed sed syntax, I can't replace strings with a blank string. The issue is likely in these regex.

shx echo 'foobar' | shx sed 'bar' '' # previous syntax, returned 'foo'
shx echo 'foobar' | shx sed 's/bar/lish/' # returns 'foolish'
shx echo 'foobar' | shx sed 's/bar/ /' # returns 'foo '
shx echo 'foobar' | shx sed 's/bar//' # crashes with 'sed: invalid replacement string'
echo 'foobar' | sed 's/bar//' # returns 'foo'

chore: switch appveyor to my account

appveyor is still under Ari's account, which I don't have access to, so I can't restart failed builds.

I already have an appveyor account under the "shelljs" username, I just need to actually get around to switching this over.

chore: consider allowing iojs failures on travis

I've noticed that iojs seems to be failing often on Travis, usually due to nvm issues. We should probably consider allowing failures for iojs builds until things get consistent. Because we're testing on v0.12 and v4, it's pretty unlikely that those will pass but we'll get actual failures on iojs.

This way we can continue supporting iojs, but won't be bogged down by flakiness on the travis machines.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.