{"id":16840734,"url":"https://github.com/nfischer/n_shell","last_synced_at":"2025-03-22T05:30:56.668Z","repository":{"id":43736187,"uuid":"54754553","full_name":"nfischer/n_shell","owner":"nfischer","description":"A NodeJS REPL with ShellJS loaded by default","archived":false,"fork":false,"pushed_at":"2024-06-23T20:30:23.000Z","size":120,"stargazers_count":8,"open_issues_count":5,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-18T08:22:11.842Z","etag":null,"topics":["node-repl","shelljs","shelljs-plugin"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/n_shell","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nfischer.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-26T00:14:32.000Z","updated_at":"2024-06-23T18:48:33.000Z","dependencies_parsed_at":"2024-06-23T05:03:35.011Z","dependency_job_id":"860653a7-850c-46c9-abae-9eed85da9400","html_url":"https://github.com/nfischer/n_shell","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfischer%2Fn_shell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfischer%2Fn_shell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfischer%2Fn_shell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfischer%2Fn_shell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nfischer","download_url":"https://codeload.github.com/nfischer/n_shell/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244912800,"owners_count":20530764,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["node-repl","shelljs","shelljs-plugin"],"created_at":"2024-10-13T12:37:53.880Z","updated_at":"2025-03-22T05:30:54.514Z","avatar_url":"https://github.com/nfischer.png","language":"JavaScript","readme":"# n\\_shell\n\n[![GitHub Actions](https://img.shields.io/github/actions/workflow/status/nfischer/n_shell/main.yml?style=flat-square\u0026logo=github)](https://github.com/nfischer/n_shell/actions/workflows/main.yml)\n[![Codecov](https://img.shields.io/codecov/c/github/nfischer/n_shell.svg?style=flat-square)](https://codecov.io/gh/nfischer/n_shell)\n[![npm version](https://img.shields.io/npm/v/n_shell.svg?style=flat-square)](https://www.npmjs.com/package/n_shell)\n[![npm downloads](https://img.shields.io/npm/dt/n_shell.svg?style=flat-square)](https://www.npmjs.com/package/n_shell)\n\nA node REPL with ShellJS loaded by default.\n\nThis was inspired by (and forked from) [n\\_](https://github.com/borisdiakur/n_).\n\n## Like it?\n\nGive it a star [on Github](https://github.com/nfischer/n_shell)\n\n## Installation:\n\n```Bash\n$ npm install -g n_shell\n```\n\n## Usage:\n\nInvoking `n_shell` starts a node REPL with ShellJS required globally, with\nshell-like output:\n\n```Bash\nbash $ n_shell\nshelljs $ ls()\nLICENSE\nREADME.md\nbin\nnode_modules\npackage.json\nsrc\ntmp\nshelljs $ pwd()\n/path/to/dir\n```\n\n### But I don't want to use `shelljs/global`\n\nNo problem:\n\n```\nbash $ n_shell --no_global\nshelljs $ typeof ls // not in the global namespace\n'undefined'\nshelljs $ shell.ls() // uses 'shell' prefix\nLICENSE\nREADME.md\nbin\nnode_modules\npackage.json\nsrc\ntmp\nshelljs $ shell.pwd()\n/path/to/dir\n```\n\n### But I want to use a different namespace\n\nYou're covered:\n\n```\nbash $ n_shell --no_global=$\nshelljs $ $.ls() // now uses '$' as the prefix\nLICENSE\nREADME.md\nbin\nnode_modules\npackage.json\nsrc\ntmp\nshelljs $ $.pwd()\n/path/to/dir\n```\n\n### But I want to use a different version of ShellJS\n\nJust install that version locally (`npm install shelljs`) and start up\n`n_shell` with the `--path` option:\n\n```\nbash $ n_shell --path=node_modules/shelljs\nshelljs $\n```\n\n### But I want plain JavaScript output\n\n```javascript\nbash $ n_shell --noinspect\nshelljs $ ls()\n[ 'LICENSE',\n  'README.md',\n  'index.js',\n  'node_modules',\n  'package.json',\n  stdout: 'LICENSE\\nREADME.md\\nindex.js\\nnode_modules\\npackage.json\\n',\n  stderr: null,\n  code: 0,\n  to: [Function],\n  toEnd: [Function],\n  cat: [Function],\n  head: [Function],\n  sed: [Function],\n  sort: [Function],\n  tail: [Function],\n  grep: [Function],\n  exec: [Function] ]\n```\n\n## Available commands\n\nThis supports any command that ShellJS supports. It also adds some extra\ncommands, for convenience. So far, this adds:\n\n - `shell.clear()` (from\n   [shelljs-plugin-clear](https://github.com/nfischer/shelljs-plugin-clear))\n - `shell.open()` (from\n   [shelljs-plugin-open](https://github.com/shelljs/plugin-open))\n - `shell.sleep()` (from\n   [shelljs-plugin-sleep](https://github.com/nfischer/shelljs-plugin-sleep))\n\n## Options\n\n - `--global`: Start a node REPL with the equivalent of\n   `require('shelljs/global')`. This is the default behavior.\n - `--no_global [PREFIX]`, `--local [PREFIX]`, `-n [PREFIX]`: Start a node REPL\n   with the equivalent of `var PREFIX = require('shelljs')`. `PREFIX` defaults\n   to `shell`, if not specified.\n - `--use_strict`: enforce strict mode (default is false)\n - `--prompt \u003cFORMAT\u003e`: use this format to generate the REPL prompt. Default is\n   \"`shelljs %v%l $ `\"\n    - `%%`: a literal `%` sign\n    - `%v`: show the current version (from `package.json`)\n    - `%l`: show ` [local]` if this is using a local version of ShellJS\n    - Want more format options? [Let me\n      know](https://github.com/nfischer/n_shell/issues/new) or [send me a\n      PR](https://github.com/nfischer/n_shell/compare)\n - `--noinspect`: disable the default `--inspect` behavior. This provides\n   less-readable REPL output, but behaves just as a standard Node REPL would.\n - `--path=path/to/shelljs/`: the argument should be a path to a folder\n   containing a ShellJS package.\n - `--inspect` (default): an experimental switch to add a `.inspect()` method to\n   the output of each command. The return values are still ShellStrings, but\n   appear more readable and shell-like. Also, commands with no arguments can be\n   invoked without parentheses, such as `shell.pwd` and `shell.ls`. Recommended\n   for ShellJS v0.7+. Credit for the idea goes to\n   [piranna](https://github.com/piranna).\n\n## History\n\nSimilarly to `n_`, `n_shell` stores REPL history under `~/.n_shell_history`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfischer%2Fn_shell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnfischer%2Fn_shell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfischer%2Fn_shell/lists"}