question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Interactive commands

See original GitHub issue

Description

Allow input from interactive commands such as mdspell (https://github.com/armano2/node-markdown-spellcheck). This package for example offers a selection for miss-spelled words. Lint staged does not allow input or prints output from the package, thereby running for ever.

Steps to reproduce

  1. Install lint-staged, husky and https://github.com/armano2/node-markdown-spellcheck (for now, maintained fork)

  2. Configure <kbd>lint-staged.config.js</kbd>:

    module.exports = {
      "*.md": "mdspell"
    }
    

    Configure husky with pre-commit hooks.

  3. Stage and Commit a markdown file with a miss-spelling: This sentence is wrrong

  4. lint-staged runs forever because mdspell is waiting for user input

Debug Logs

expand to view
 lint-staged:bin Running `lint-staged@10.0.8` +0ms
  lint-staged:bin Options parsed from command-line: {
  allowEmpty: false,
  concurrent: true,
  configPath: undefined,
  debug: true,
  maxArgLength: 65536,
  quiet: false,
  relative: false,
  shell: false
} +2ms
  lint-staged Loading config using `cosmiconfig` +0ms
  lint-staged Successfully loaded config from `ABCD/lint-staged.config.js`:
  lint-staged {
  lint-staged   '**/*.md': [ 'textlint --fix', 'mdspell -n' ]
  lint-staged } +41ms
  lint-staged:cfg Validating config +0ms
Running lint-staged with the following config:
{
  '**/*.md': [
    'textlint --fix',
    'mdspell -n'
  ]
}
  lint-staged:run Running all linter scripts +0ms
  lint-staged:resolveGitRepo Resolving git repo from `ABCD` +0ms
  lint-staged:resolveGitRepo Deleting GIT_DIR from env with value `undefined` +1ms
  lint-staged:git Running git command [ 'rev-parse', '--show-toplevel' ] +0ms
  lint-staged:resolveGitRepo Resolved git directory to be `ABCD` +52ms
  lint-staged:resolveGitRepo Resolved git config directory to be `ABCD/.git` +1ms
  lint-staged:git Running git command [ 'diff', '--staged', '--diff-filter=ACMR', '--name-only' ] +53ms
  lint-staged:run Loaded list of staged files in git:
  lint-staged:run [
  lint-staged:run   'CONTRIBUTING.md',
  lint-staged:run   'docs/deployment.md',
  lint-staged:run   'docs/development.md',
  lint-staged:run   'docs/interfaces.md',
  lint-staged:run   'docs/remote-publishing.md',
  lint-staged:run   'docs/setup.md',
  lint-staged:run   'docs/style-guide.md',
  lint-staged:run   'docs/test-protocol.md'
  lint-staged:run ] +115ms
  lint-staged:chunkFiles Resolved an argument string length of 563 characters from 8 files +0ms
  lint-staged:chunkFiles Creating 1 chunks for maxArgLength of 65536 +0ms
  lint-staged:gen-tasks Generating linter tasks +0ms
  lint-staged:gen-tasks Generated task:
  lint-staged:gen-tasks {
  lint-staged:gen-tasks   pattern: '**/*.md',
  lint-staged:gen-tasks   commands: [ 'textlint --fix', 'mdspell -n' ],
  lint-staged:gen-tasks   fileList: [
  lint-staged:gen-tasks     'ABCD/CONTRIBUTING.md',
  lint-staged:gen-tasks     'ABCD/docs/deployment.md',
  lint-staged:gen-tasks     'ABCD/docs/development.md',
  lint-staged:gen-tasks     'ABCD/docs/interfaces.md',
  lint-staged:gen-tasks     'ABCD/docs/remote-publishing.md',
  lint-staged:gen-tasks     'ABCD/docs/setup.md',
  lint-staged:gen-tasks     'ABCD/docs/style-guide.md',
  lint-staged:gen-tasks     'ABCD/docs/test-protocol.md'
  lint-staged:gen-tasks   ]
  lint-staged:gen-tasks } +3ms
  lint-staged:make-cmd-tasks Creating listr tasks for commands [ 'textlint --fix', 'mdspell -n' ] +6ms
  lint-staged:task cmd: textlint +1ms
  lint-staged:task args: [ '--fix' ] +1ms
  lint-staged:task execaOptions: { preferLocal: true, reject: false, shell: false } +0ms
  lint-staged:task cmd: mdspell +1ms
  lint-staged:task args: [ '-n' ] +0ms
  lint-staged:task execaOptions: { preferLocal: true, reject: false, shell: false } +0ms
Preparing... [started]
  lint-staged:git Backing up original state... +0ms
  lint-staged:git Backing up merge state... +0ms
  lint-staged:file Reading file `ABCD/.git/MERGE_HEAD` +0ms
  lint-staged:file Reading file `ABCD/.git/MERGE_MODE` +1ms
  lint-staged:file Reading file `ABCD/.git/MERGE_MSG` +0ms
  lint-staged:file File `ABCD/.git/MERGE_HEAD` doesn't exist, ignoring... +11ms
  lint-staged:file File `ABCD/.git/MERGE_MODE` doesn't exist, ignoring... +1ms
  lint-staged:file File `ABCD/.git/MERGE_MSG` doesn't exist, ignoring... +1ms
  lint-staged:git Done backing up merge state! +16ms
  lint-staged:git Running git command [ 'ls-files', '--deleted' ] +112ms
  lint-staged:git Running git command [
  'stash',
  'save',
  '--include-untracked',
  '--keep-index',
  'lint-staged automatic backup'
] +113ms
  lint-staged:git Restoring merge state... +1s
  lint-staged:git Done restoring merge state! +1ms
  lint-staged:git Running git command [ 'ls-files', '--others', '--exclude-standard' ] +1s
  lint-staged:git Running git command [ 'stash', 'list' ] +86ms
  lint-staged:git Running git command [
  'diff',
  '--binary',
  '--unified=0',
  '--no-color',
  '--no-ext-diff',
  '--patch',
  '--output=ABCD/.git/lint-staged_unstaged.patch',
  'stash@{0}',
  '-R'
] +159ms
  lint-staged:git Done backing up original state! +487ms
Preparing... [completed]
Running tasks... [started]
textlint --fix [started]
textlint --fix [completed]
mdspell -n [started]

Environment

  • OS: Arch Linux
  • Node.js: v13.3.0
  • lint-staged: 10.0.8

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
iirojcommented, Apr 27, 2020

Listr2 is coming in the linked PR #852 . After that task input is a possible feature. It would imply a concurrency of 1, though.

EDIT: oops, didn’t mean that the PR should close this issue.

1reaction
okonetcommented, Mar 30, 2020

That would be amazing!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Interactive Commands - IBM
Interactive Commands. There are commands that require a continued dialog before they can be processed. Such commands are routed to a NetView 3270...
Read more >
Interactive Commands
Nutmeg or interactive Spice3 can plot data from a simulation on a graphics terminal or a workstation display. Most of the commands available...
Read more >
36.1. Interactive and non-interactive shells and scripts
An interactive shell reads commands from user input on a tty. Among other things, such a shell reads startup files on activation, displays...
Read more >
Interactive Commands - Zrips
Interactive command feature allows to create blocks or entities which will perform defined commands on interaction with them. How to create one:
Read more >
CLI interactive commands
Interactive commands requiring additional options​​ A warning message is displayed when these commands are executed, for example: Interactive mode is disabled; ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found