Socket
Book a DemoInstallSign in
Socket

csv-runner

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csv-runner

A command-line tool to execute commands from CSV files

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

CSV Runner

A Node.js command-line tool to execute commands listed in a CSV file, track their execution status, and save results for future runs.

Features

  • Accepts a CSV file as input.
  • Prompts the user to select which column contains the commands to execute.
  • Executes each command in the selected column.
  • Tracks which commands have been executed, and their results (success, error, or not yet run).
  • Saves execution results, including errors and output, to a new CSV file.
  • Skips commands that have already been executed successfully in previous runs.

Usage

  • Install dependencies (if any):

    npm install
    
  • Run the script:

    csv-runner path/to/your.csv
    
  • Follow the prompt:

    • The script will display the columns in your CSV and ask which one contains the commands to execute.
  • Execution tracking:

    • The script will create or update a results CSV (e.g., your_results.csv) with the following columns:
      • Original columns from your input CSV
      • command_executed: The command that was run
      • state: success, error, or empty
      • output: The output or error message from the command
  • Re-running:

    • If you run the script again with the same CSV, it will skip commands already marked as success or error in the results CSV, unless you choose to re-run them.

Example CSV

idscript
1echo "Hello World"
2ls -l
3invalidcommand

Example Results CSV

idscriptcommand_executedstateoutput
1echo "Hello World"echo "Hello World"successHello World
2ls -lls -lsuccess...output...
3invalidcommandinvalidcommanderror...error message...

Implementation Notes

  • Use Node.js built-in modules and/or libraries like csv-parser, csv-writer, and inquirer for prompts.
  • Use child_process.exec to run commands.
  • Ensure safe execution: consider security implications of running arbitrary commands.
  • Handle errors gracefully and record them in the results CSV.

License

MIT

Keywords

csv

FAQs

Package last updated on 07 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts