Skip to content

Latest commit

Β 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ rk-cli-utils

Supercharge Your DevOps Workflow ⚑

License: MIT Version Platform Ubuntu RHEL Shell PRs Welcome

A collection of lightweight CLI utilities designed to simplify everyday DevOps and developer workflows, boosting productivity and ensuring consistency across your team.

Features β€’ Installation β€’ Usage β€’ Documentation β€’ Contributing


🎯 Why rk-cli-utils?

🎨 Simple & Elegant

Clean, intuitive commands that just work

⚑ Lightning Fast

Pure bash implementation with zero overhead

πŸ”§ DevOps Ready

Built for modern CI/CD pipelines


✨ Features

πŸ” SSH Setup Made Easy

Configure Git and SSH keys in seconds, not minutes

# One command to rule them all
setup-ssh --email dev@company.com --user "John Doe" --key-file ~/.ssh/id_rsa

What it does:

  • βœ… Configures Git user credentials globally
  • βœ… Sets up SSH keys for GitHub/GitHub Enterprise
  • βœ… Automatically rewrites HTTPS URLs to SSH
  • βœ… Adds hosts to known_hosts securely
  • βœ… Supports custom Git hosting platforms

πŸ’¬ Slack Integration

Send beautiful, color-coded messages to multiple channels instantly

# Notify your team with style
slack-send --token xoxb-your-token \
           --channel "#deployments,#alerts" \
           --message "πŸš€ Production deployment successful!" \
           --color good

Capabilities:

  • πŸ“’ Multi-channel broadcasting
  • 🎨 Color-coded messages (good/warning/danger/custom hex)
  • πŸ“ Message sections with ~ delimiter
  • πŸ” User lookup by email
  • ⚑ Async delivery with error handling

πŸ” Slack User Lookup

Find Slack user IDs from email addresses effortlessly

get-slack-id --email user@company.com --token xoxb-your-token

πŸ“¦ Installation

πŸš€ Quick Install (Auto-detect OS)

The installation script automatically detects your Linux distribution and installs the appropriate package:

curl -fsSL https://raw.githubusercontent.com/Raufk/rk-cli-utils/main/install/install.sh | bash

Supported Platforms:

  • βœ… Ubuntu / Debian (.deb package)
  • βœ… RHEL / CentOS / Rocky / AlmaLinux (.rpm package)

Manual Installation

πŸ“₯ Ubuntu/Debian - Download DEB Package
# Download the latest release
curl -LO https://github.com/Raufk/rk-cli-utils/releases/download/v1.0/rk-cli-utils.deb

# Install
sudo dpkg -i rk-cli-utils.deb

# Verify installation
rk --version
πŸ“₯ RHEL/CentOS - Download RPM Package
# Download and install directly
sudo yum install https://github.com/Raufk/rk-cli-utils/releases/download/v1.0/rk-cli-utils-1.0-1.el9.noarch.rpm

# Or download first, then install
wget https://github.com/Raufk/rk-cli-utils/releases/download/v1.0/rk-cli-utils-1.0-1.el9.noarch.rpm
sudo yum localinstall rk-cli-utils-1.0-1.el9.noarch.rpm

# Verify installation
rk --version
πŸ”¨ Build from Source (Using Makefile)

Build Both RPM and DEB Packages

# Clone the repository
git clone https://github.com/Raufk/rk-cli-utils.git
cd rk-cli-utils

# Build both packages (recommended)
make all

# Packages will be created in:
# - RPM: ~/rpmbuild/RPMS/noarch/rk-cli-utils-*.rpm
# - DEB: build/deb/rk-cli-utils-*.deb

Build RPM Package Only (RHEL/CentOS/Rocky/AlmaLinux)

# Build RPM package
./build_package.sh

# or
make rpm

# Install
sudo yum localinstall ~/rpmbuild/RPMS/noarch/rk-cli-utils-*.rpm

# Verify
rk --version

Build DEB Package Only (Ubuntu/Debian)

# Build DEB package
make deb

# Install
sudo dpkg -i build/deb/rk-cli-utils-*.deb

# Verify
rk --version

Clean Build Artifacts

# Remove all build files
make clean

Available Make Targets

Target Description
make all Build both RPM and DEB packages (default)
make rpm Build RPM package only
make deb Build DEB package only
make clean Remove all build artifacts
make prepare Prepare build environment (version injection)

πŸš€ Usage

Command Overview

Command Description Example
setup-ssh Configure SSH & Git setup-ssh --email dev@co.com --user "Dev" --key-file ~/.ssh/id_rsa
slack-send Send Slack messages slack-send --token TOKEN --channel "#ops" --message "Hello!"
get-slack-id Get Slack user ID get-slack-id --email user@co.com --token TOKEN

πŸ“š Detailed Examples

πŸ” SSH Setup Examples

Basic Setup (GitHub)

setup-ssh \
  --email developer@company.com \
  --user "Jane Developer" \
  --key-file ~/.ssh/id_rsa

GitHub Enterprise Setup

setup-ssh \
  --email dev@company.com \
  --user "Dev Team" \
  --key-file ~/.ssh/ghe_key \
  --host github.enterprise.com

Using Key Content Directly

setup-ssh \
  --email dev@company.com \
  --user "CI Bot" \
  --key-file "$(cat /secure/path/to/key)"
πŸ’¬ Slack Messaging Examples

Success Notification

slack-send \
  --token xoxb-your-slack-token \
  --channel "#deployments" \
  --message "βœ… Production deployment completed successfully!" \
  --color good

Warning Alert

slack-send \
  --token xoxb-your-slack-token \
  --channel "#alerts" \
  --message "⚠️ High memory usage detected on server-01" \
  --color warning

Critical Error

slack-send \
  --token xoxb-your-slack-token \
  --channel "#incidents,#on-call" \
  --message "🚨 Database connection failed~Check logs immediately" \
  --color danger

Custom Color

slack-send \
  --token xoxb-your-slack-token \
  --channel "#general" \
  --message "πŸ“Š Weekly report is ready" \
  --color "#36a64f"
πŸ” User Lookup Example
# Get Slack user ID
SLACK_ID=$(get-slack-id \
  --email john.doe@company.com \
  --token xoxb-your-slack-token)

echo "User ID: $SLACK_ID"

πŸ—οΈ Architecture

rk-cli-utils/
β”œβ”€β”€ πŸ“ bin/
β”‚   └── rk                    # Main CLI dispatcher
β”œβ”€β”€ πŸ“ lib/
β”‚   β”œβ”€β”€ ssh.sh               # SSH setup logic
β”‚   └── slack.sh             # Slack API integration
β”œβ”€β”€ πŸ“ wrappers/
β”‚   β”œβ”€β”€ setup-ssh            # Direct command wrapper
β”‚   β”œβ”€β”€ slack-send           # Direct command wrapper
β”‚   └── get-slack-id         # Direct command wrapper
β”œβ”€β”€ πŸ“ packaging/
β”‚   └── rk-cli-utils.spec    # RPM package specification
β”œβ”€β”€ πŸ“ install/
β”‚   └── install.sh           # Installation script
└── build_package.sh         # Build automation

πŸ”§ Requirements

Dependency Purpose Installation
bash Shell interpreter Pre-installed
git Version control yum install git
curl HTTP client yum install curl
jq JSON processor yum install jq
openssh-clients SSH tools yum install openssh-clients

πŸŽ“ Documentation

Environment Variables

# Optional: Set default Slack token
export SLACK_TOKEN="xoxb-your-token"

# Optional: Set default Git host
export GIT_HOST="github.enterprise.com"

Exit Codes

Code Meaning
0 Success
1 General error
2 Missing required parameter
3 Network/API error

🀝 Contributing

We love contributions! πŸ’™

Contributors Issues Pull Requests

How to Contribute

  1. 🍴 Fork the repository
  2. 🌿 Create your feature branch (git checkout -b feature/AmazingFeature)
  3. ✍️ Commit your changes (git commit -m 'Add some AmazingFeature')
  4. πŸ“€ Push to the branch (git push origin feature/AmazingFeature)
  5. πŸŽ‰ Open a Pull Request

πŸ“ License

This project is licensed.


πŸ‘¨β€πŸ’» Author

Rauf K

Email GitHub


🌟 Show Your Support

If this project helped you, please consider giving it a ⭐️!

Star History Chart


πŸ“Š Project Stats

GitHub repo size GitHub code size Lines of code


πŸ’‘ Built with ❀️ for the DevOps Community

⬆ Back to Top

About

A collection of lightweight CLI utilities to simplify everyday DevOps and developer workflows to improve productivity and consistency.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages