Command Line Tool To Combine Commands Into One
Have you ever got tired of typing in the same commands in the same way for to long time such as
npm build -> npm run dev,
dotnet build -> dotnet run,
python3 script.py -> pytest, etc.?
One Line Solves That!
One-Line is a production-ready CLI tool that enables developers to create, manage, and execute any command sequences through a terminal-based menu. Built with TypeScript, it works with any command - npm, dotnet, python, go, cargo, make, or anything else you use. Just save your command sequences and run them with a single shortcut!
π Now available on npm! Install with: npm install -g one-line-cli
npm install -g one-line-cliThen run one-line to get started!
- Works with ANY Command: npm, dotnet, python, go, cargo, make, docker, kubectl - anything!
- Tab Completion is automatically installed when you install the package!
- Save Command Sequences: Combine multiple commands into one named shortcut
- Tab Completion: Press Tab to see and autocomplete your saved commands (bash/zsh)
- Sequential Execution: Commands run one after another, stopping on failure (like
&&) - Interactive Management: Easy-to-use menus for viewing, running, and managing commands
- Cross-Platform: Works on macOS, Linux, and Windows
Install from npm (Recommended):
npm install -g one-line-cliIf you need to manually install or reinstall completion:
# Auto-detect and install (recommended)
one-line install-completion
# Or manually for specific shell
one-line completion zsh >> ~/.zshrc # macOS (zsh)
one-line completion bash >> ~/.bashrc # Linux (bash)
source ~/.zshrc # or source ~/.bashrcAfter installation, press Tab after typing one-line to see all your saved commands!
Note: macOS uses zsh by default (since macOS Catalina 10.15). The auto-installer will detect this automatically.
Or install from source:
git clone https://github.com/Mykyta-G/One-Line.git
cd One-Line
npm run build
cd packages/cli
npm linkInteractive Mode (recommended for beginners):
one-lineThis opens an interactive menu where you can:
- View all saved commands
- Run a command
- Add new commands
- Delete commands
- View command details
Command Line Mode:
# Add a new command
one-line add
# List all commands
one-line list
# Run a command by alias (fastest)
one-line build
# Or run by full name
one-line run "Build my program"
# Delete a command
one-line delete "Build my program"
# Edit a command
one-line edit "Build my program"
# Enable tab completion
# macOS (uses zsh by default):
one-line completion zsh >> ~/.zshrc
source ~/.zshrc
# Linux/bash:
one-line completion bash >> ~/.bashrc
source ~/.bashrcOne-Line works with any command, not just npm! Here are examples:
C# / .NET:
one-line add
# Name: Build and Run C# Project
# Steps:
# dotnet build
# dotnet runPython:
one-line add
# Name: Run Python Tests
# Steps:
# python3 -m pytest
# python3 main.pyGo:
one-line add
# Name: Build Go Binary
# Steps:
# go build -o app
# ./appRust:
one-line add
# Name: Cargo Build and Test
# Steps:
# cargo build
# cargo testDocker:
one-line add
# Name: Docker Build and Run
# Steps:
# docker build -t myapp .
# docker run -p 3000:3000 myappMixed Commands:
one-line add
# Name: Full Deployment
# Steps:
# npm run build
# docker build -t app .
# kubectl apply -f k8s/One-Line automatically creates shell-safe aliases for your commands:
- "Build My Program" β alias:
build-my-program - "Deploy to prod" β alias:
deploy-to-prod - "Test & Deploy!" β alias:
test-deploy
Run commands directly by alias:
one-line build-my-program
one-line deploy-to-prodOne-Line protects you from accidentally overwriting system commands:
- Reserved Commands: Cannot use aliases like
ls,git,npm,cd, etc. - PATH Checking: Warns if alias conflicts with existing commands
- Smart Suggestions: Offers alternatives when conflicts detected
One-Line/
βββ packages/
β βββ core/ # Shared library for command management
β βββ cli/ # Standalone CLI application
βββ scripts/ # Build and packaging scripts
βββ README.md
- Node.js 18+ and npm
- TypeScript knowledge for contributions
# Clone the repository
git clone https://github.com/yourusername/One-Line.git
cd One-Line
# Install dependencies and build
npm run build
# Test CLI locally
cd packages/cli
npm link# Package CLI
npm run package:cliCommands are stored in ~/.one-line/commands.json as JSON:
{
"commands": [
{
"id": "uuid-here",
"name": "Build my program",
"alias": "build-my-program",
"steps": ["npm run build", "npm run dev"],
"createdAt": "2024-01-05T12:00:00.000Z"
},
{
"id": "uuid-here-2",
"name": "Build and Run C# Project",
"alias": "build-and-run-c-project",
"steps": ["dotnet build", "dotnet run"],
"createdAt": "2024-01-05T12:00:00.000Z"
},
{
"id": "uuid-here-3",
"name": "Run Python Tests",
"alias": "run-python-tests",
"steps": ["python3 -m pytest", "python3 main.py"],
"createdAt": "2024-01-05T12:00:00.000Z"
}
]
}Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License with Attribution Required - see the LICENSE file for details. Any derivative works must provide clear attribution to the original author.
- Use descriptive names for your commands - they'll be converted to safe aliases
- Avoid reserved words like "git", "npm", "docker" as command names
- Keep sequences focused - one command = one workflow
- Use interactive mode when you're unsure of exact command names
- Commands run in CWD - current working directory
- Sequential execution - stops on first failure (like using
&&in shell) - Aliases are faster - use
one-line buildinstead ofone-line run "Build"
Created and maintained by Mykyta Grogul
This project was built with a focus on developer productivity and workflow optimization. Special thanks to the open-source community for the excellent tools and libraries that made this possible.