{"id":29377923,"url":"https://github.com/steven-pribilinskiy/shiny-command-line","last_synced_at":"2026-01-20T16:39:52.447Z","repository":{"id":303833577,"uuid":"1016997813","full_name":"steven-pribilinskiy/shiny-command-line","owner":"steven-pribilinskiy","description":"Pretty command line formatter with multiline display, operator detection, flag formatting, and syntax highlighting","archived":false,"fork":false,"pushed_at":"2025-07-09T21:45:21.000Z","size":53,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-09T23:36:11.978Z","etag":null,"topics":["cli","command-line","developer-tools","formatting","nodejs","npm-package","pretty-print","shell","syntax-highlighting","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/steven-pribilinskiy.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":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-09T21:34:09.000Z","updated_at":"2025-07-09T21:45:22.000Z","dependencies_parsed_at":"2025-07-09T23:36:33.753Z","dependency_job_id":"0e7433de-279a-42f9-86f8-07013954ddb1","html_url":"https://github.com/steven-pribilinskiy/shiny-command-line","commit_stats":null,"previous_names":["steven-pribilinskiy/shiny-command-line"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/steven-pribilinskiy/shiny-command-line","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steven-pribilinskiy%2Fshiny-command-line","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steven-pribilinskiy%2Fshiny-command-line/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steven-pribilinskiy%2Fshiny-command-line/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steven-pribilinskiy%2Fshiny-command-line/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steven-pribilinskiy","download_url":"https://codeload.github.com/steven-pribilinskiy/shiny-command-line/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steven-pribilinskiy%2Fshiny-command-line/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264505787,"owners_count":23618972,"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":["cli","command-line","developer-tools","formatting","nodejs","npm-package","pretty-print","shell","syntax-highlighting","typescript"],"created_at":"2025-07-10T00:09:34.347Z","updated_at":"2026-01-20T16:39:52.419Z","avatar_url":"https://github.com/steven-pribilinskiy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🌟 Shiny Command Line\n\nPretty command line formatter with multiline display, operator detection, flag formatting, and syntax highlighting.\n\n[![npm version](https://badge.fury.io/js/shiny-command-line.svg)](https://www.npmjs.com/package/shiny-command-line)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n## 📋 Features\n\n- **Command Parsing**: Uses `shell-quote` for command parsing\n- **Pretty Formatting**: Formats long commands with proper line breaks\n- **Operator Detection**: Recognizes `\u0026\u0026`, `||`, `;`, `|` and formats accordingly\n- **Line Breaking**: Breaks lines at appropriate points\n- **Option Grouping**: Keeps long options with their values together\n- **Flag Formatting**: Option to put each flag on a new line for better readability\n- **Syntax Highlighting**: Colorizes commands, operators, flags, and arguments by default\n- **Configurable**: Customizable line width, indentation, and formatting options\n- **TypeScript**: Full TypeScript support with type definitions\n- **Minimal Dependencies**: Only depends on `shell-quote` and `chalk`\n\n## 📦 Installation\n\n```bash\nnpm install shiny-command-line\n```\n\n## 🚀 Quick Start\n\n```typescript\nimport { prettifyCommand, shouldPrettifyCommand, getCommandPreview } from 'shiny-command-line';\n\n// Basic usage\nconst command = 'npm run build \u0026\u0026 npm run test --coverage --verbose \u0026\u0026 npm run deploy --env=production';\nconst prettified = prettifyCommand(command);\n\nconsole.log(prettified);\n// Output:\n// npm run build \u0026\u0026\n//   npm run test \\\\\n//     --coverage \\\\\n//     --verbose \u0026\u0026\n//   npm run deploy \\\\\n//     --env=production\n\n// With advanced formatting\nconst dockerCmd = 'docker run -d --name myapp -p 3000:3000 -e NODE_ENV=production myapp:latest';\nconst advanced = prettifyCommand(dockerCmd, { \n  flagsOnNewLine: true\n});\n\nconsole.log(advanced);\n// Output (with colors by default):\n// docker run \\\n//   -d \\\n//   --name myapp \\\n//   -p 3000:3000 \\\n//   -e NODE_ENV=production \\\n//   myapp:latest\n```\n\n## 📚 API Reference\n\n### `prettifyCommand(command, options?)`\n\nFormats a command string with multiline display.\n\n**Parameters:**\n- `command` (string): The command to prettify\n- `options` (object, optional):\n  - `maxWidth` (number): Maximum line width (default: 80)\n  - `indent` (string): Indentation string (default: '  ')\n  - `flagsOnNewLine` (boolean): Put each flag on a new line (default: false)\n  - `disableColors` (boolean): Disable syntax highlighting (default: false)\n\n**Returns:** Prettified command string\n\n```typescript\nimport { prettifyCommand } from 'shiny-command-line';\n\n// Basic formatting\nconst result = prettifyCommand(\n  'docker build -t myapp . \u0026\u0026 docker run -p 3000:3000 myapp'\n);\n\n// Advanced formatting with flags on new lines\nconst advanced = prettifyCommand(\n  'docker run -d --name myapp -p 3000:3000 -e NODE_ENV=production myapp:latest',\n  { \n    maxWidth: 60, \n    indent: '    ',\n    flagsOnNewLine: true\n  }\n);\n\n// To disable colors\nconst disableColors = prettifyCommand(dockerCmd, { disableColors: true });\n```\n\n### `shouldPrettifyCommand(command, threshold?)`\n\nDetermines if a command should be prettified based on complexity.\n\n**Parameters:**\n- `command` (string): The command to analyze\n- `threshold` (number): Length threshold (default: 80)\n\n**Returns:** Boolean indicating if prettification is recommended\n\n```typescript\nimport { shouldPrettifyCommand } from 'shiny-command-line';\n\nconsole.log(shouldPrettifyCommand('ls -la')); // false\nconsole.log(shouldPrettifyCommand('npm run build \u0026\u0026 npm run test')); // true\nconsole.log(shouldPrettifyCommand('command --option1 --option2 --option3 --option4')); // true\n```\n\n### `getCommandPreview(command, options?)`\n\nGets both original and prettified versions of a command.\n\n**Parameters:**\n- `command` (string): The command to preview\n- `options` (object, optional):\n  - `showPretty` (boolean): Include prettified version (default: false)\n  - `maxWidth` (number): Maximum line width (default: 80)\n  - `indent` (string): Indentation string (default: '  ')\n  - `flagsOnNewLine` (boolean): Put each flag on a new line (default: false)\n  - `disableColors` (boolean): Disable syntax highlighting (default: false)\n\n**Returns:** Object with `original`, `pretty`, and `shouldPrettify` properties\n\n```typescript\nimport { getCommandPreview } from 'shiny-command-line';\n\nconst preview = getCommandPreview(\n  'npm run build \u0026\u0026 npm run test',\n  { showPretty: true, flagsOnNewLine: true }\n);\n\nconsole.log(preview.original);     // Original command\nconsole.log(preview.pretty);       // Prettified version (if shouldPrettify is true)\nconsole.log(preview.shouldPrettify); // true\n```\n\n### `prettifyCommands(commands, options?)`\n\nFormats multiple commands in batch.\n\n**Parameters:**\n- `commands` (string[]): Array of commands to prettify\n- `options` (object, optional): Same as `prettifyCommand`\n\n**Returns:** Array of prettified command strings\n\n```typescript\nimport { prettifyCommands } from 'shiny-command-line';\n\nconst commands = [\n  'npm run build \u0026\u0026 npm run test',\n  'docker build -t app . \u0026\u0026 docker run app'\n];\n\nconst prettified = prettifyCommands(commands, { \n  flagsOnNewLine: true\n});\n```\n\n## 🎯 Examples\n\n### Flag Formatting\n\n```typescript\nconst dockerCmd = 'docker run -d --name myapp --restart=unless-stopped -p 3000:3000 -p 4000:4000 -e NODE_ENV=production -e DATABASE_URL=postgres://user:pass@localhost:5432/db -v /host/logs:/app/logs myapp:latest';\n\n// Standard formatting\nconsole.log(prettifyCommand(dockerCmd));\n// Output:\n// docker run \\\\\n//   -d \\\\\n//   --name myapp \\\\\n//   --restart=unless-stopped \\\\\n//   -p 3000:3000 \\\\\n//   -p 4000:4000 \\\\\n//   -e NODE_ENV=production \\\\\n//   -e DATABASE_URL=postgres://user:pass@localhost:5432/db \\\\\n//   -v /host/logs:/app/logs \\\\\n//   myapp:latest\n\n// With flags on new lines (better for complex commands)\nconsole.log(prettifyCommand(dockerCmd, { flagsOnNewLine: true }));\n// Output:\n// docker run \\\\\n//   -d \\\\\n//   --name myapp \\\\\n//   --restart=unless-stopped \\\\\n//   -p 3000:3000 \\\\\n//   -p 4000:4000 \\\\\n//   -e NODE_ENV=production \\\\\n//   -e DATABASE_URL=postgres://user:pass@localhost:5432/db \\\\\n//   -v /host/logs:/app/logs \\\\\n//   myapp:latest\n```\n\n### Syntax Highlighting\n\n```typescript\nconst complexCmd = 'npm run build \u0026\u0026 docker build -t myapp:latest . \u0026\u0026 curl -X POST https://api.example.com/deploy --data-binary @package.json';\n\n// With colors (default behavior)\nconsole.log(prettifyCommand(complexCmd));\n// Commands appear in cyan, operators in yellow, flags in green, etc.\n\n// Without colors\nconsole.log(prettifyCommand(complexCmd, { disableColors: true }));\n```\n\n**Color Scheme:**\n- **Commands**: Cyan bold (`npm`, `docker`, `curl`)\n- **Operators**: Yellow bold (`\u0026\u0026`, `||`, `;`, `|`)\n- **Flags**: Green (`--flag`, `-f`)\n- **File paths**: Blue (`./src/index.js`, `/host/path`)\n- **Key=value pairs**: Magenta (`NODE_ENV=production`)\n- **URLs**: Blue underlined (`https://api.example.com`)\n- **Arguments**: White (regular arguments)\n\n### Complex Docker Command\n\n```typescript\nconst dockerCmd = 'docker run -d --name myapp -p 3000:3000 -p 4000:4000 -e NODE_ENV=production -e DATABASE_URL=postgres://user:pass@localhost:5432/db -v /host/path:/container/path myapp:latest';\n\nconsole.log(prettifyCommand(dockerCmd, { flagsOnNewLine: true }));\n// Output (with colors by default):\n// docker run \\\n//   -d \\\n//   --name myapp \\\n//   -p 3000:3000 \\\n//   -p 4000:4000 \\\n//   -e NODE_ENV=production \\\n//   -e DATABASE_URL=postgres://user:pass@localhost:5432/db \\\n//   -v /host/path:/container/path \\\n//   myapp:latest\n```\n\n### CI/CD Pipeline\n\n```typescript\nconst ciCmd = 'npm ci \u0026\u0026 npm run lint \u0026\u0026 npm run test -- --coverage \u0026\u0026 npm run build \u0026\u0026 npm run deploy -- --env=production --verbose';\n\nconsole.log(prettifyCommand(ciCmd));\n// Output:\n// npm ci \u0026\u0026\n//   npm run lint \u0026\u0026\n//   npm run test \\\\\n//     -- \\\\\n//     --coverage \u0026\u0026\n//   npm run build \u0026\u0026\n//   npm run deploy \\\\\n//     -- \\\\\n//     --env=production \\\\\n//     --verbose\n```\n\n### Git Operations\n\n```typescript\nconst gitCmd = 'git add . \u0026\u0026 git commit -m \"feat: add new feature with tests and documentation\" \u0026\u0026 git push origin feature/new-feature';\n\nconsole.log(prettifyCommand(gitCmd, { disableColors: true }));\n// Output:\n// git add . \u0026\u0026\n//   git commit \\\\\n//     -m \"feat: add new feature with tests and documentation\" \u0026\u0026\n//   git push \\\\\n//     origin \\\\\n//     feature/new-feature\n```\n\n## 🔧 Configuration\n\n### Custom Formatting Options\n\n```typescript\nimport { prettifyCommand } from 'shiny-command-line';\n\n// Custom line width and indentation\nconst options = {\n  maxWidth: 120,\n  indent: '    ', // 4 spaces instead of 2\n  flagsOnNewLine: true,\n  disableColors: true\n};\n\nconst prettified = prettifyCommand(longCommand, options);\n```\n\n### Integration with Your CLI Tool\n\n```typescript\nimport { getCommandPreview } from 'shiny-command-line';\n\nfunction executeCommand(cmd: string, showPreview: boolean = false) {\n  if (showPreview) {\n    const preview = getCommandPreview(cmd, { \n      showPretty: true,\n      flagsOnNewLine: true,\n      disableColors: true\n    });\n    \n    if (preview.shouldPrettify \u0026\u0026 preview.pretty) {\n      console.log('Command preview:');\n      console.log('─'.repeat(50));\n      console.log(preview.pretty);\n      console.log('─'.repeat(50));\n    }\n  }\n  \n  // Execute the command...\n}\n```\n\n### Use Cases\n\n**Perfect for:**\n- **Docker commands** with many flags and options\n- **CLI tools** with complex argument structures\n- **CI/CD scripts** with chained commands\n- **Documentation** that shows command examples\n- **Developer tools** that need to display commands clearly\n- **Script runners** that preview commands before execution\n\n## 🧪 Demo\n\nRun the interactive demo to see all features in action:\n\n```bash\ngit clone https://github.com/steven-pribilinskiy/shiny-command-line.git\ncd shiny-command-line\nnpm install\nnpm run build\nnpm run demo\n```\n\nThe demo showcases:\n- Basic command analysis\n- Flag formatting comparison\n- Syntax highlighting examples\n- Batch processing capabilities ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteven-pribilinskiy%2Fshiny-command-line","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteven-pribilinskiy%2Fshiny-command-line","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteven-pribilinskiy%2Fshiny-command-line/lists"}