Add ccecho feature, and modified the main script
This commit is contained in:
52
README.md
52
README.md
@@ -11,6 +11,7 @@ This project provides a modular system for managing Bash scripts within the .bas
|
||||
- **Automatic Directory Structure**: The installer automatically creates directories for managing available, enabled, removed, and required scripts.
|
||||
- **Customizable Script Templates**: When creating a new script, a template with placeholders for options, variables, functions, and execution logic is provided.
|
||||
- **Easy Integration**: Automatically integrate with your existing .bashrc setup.
|
||||
- **Colorful Echo (`ccecho`)**: Print colored and styled messages for better terminal output, ( usable even outside of the brc-script environment )
|
||||
|
||||
## Directory Structure
|
||||
|
||||
@@ -23,14 +24,13 @@ After installation, the system uses the following directory layout to manage scr
|
||||
- `scripts-enabled/`: Symbolic links to enabled scripts.
|
||||
- `scripts-needed/`: Essential scripts required for the system to work.
|
||||
- `brc-script.sh`
|
||||
- `ccecho.sh`
|
||||
- `scripts-removed/`: Backup of removed scripts, timestamped.
|
||||
|
||||
## Installation
|
||||
|
||||
### Automated Installation
|
||||
|
||||
To install the system automatically, follow these steps:
|
||||
|
||||
1. Clone the repository:
|
||||
```bash
|
||||
git clone https://github.com/your-repo/modular-bashrc-manager.git
|
||||
@@ -46,20 +46,19 @@ To install the system automatically, follow these steps:
|
||||
The installer will:
|
||||
- Create the necessary directory structure: `scripts-needed`, `scripts-enabled`, `scripts-available`, and `scripts-removed`.
|
||||
- Append the required configuration to your .bashrc file.
|
||||
- Copy the main `brc-script.sh` script to `scripts-needed/`.
|
||||
- Copy the main `brc-script.sh` script and `ccecho.sh` to `scripts-needed/`.
|
||||
|
||||
After the installation completes, restart your shell or reload the .bashrc file by running:
|
||||
Reload the `.bashrc` file by running:
|
||||
```bash
|
||||
source ~/.bashrc
|
||||
```
|
||||
```
|
||||
|
||||
### Manual Installation
|
||||
|
||||
If you prefer a manual installation process, follow these steps:
|
||||
|
||||
1. Copy the `brc-script.sh` file to the `~/.bashrc.d/scripts-needed/` folder:
|
||||
1. Copy the `brc-script.sh` and `ccecho.sh` files to the `~/.bashrc.d/scripts-needed/` folder:
|
||||
```bash
|
||||
cp brc-script.sh ~/.bashrc.d/scripts-needed/
|
||||
chmod 750 ~/.bashrc.d/scripts-needed/brc-script.sh
|
||||
cp brc-script.sh ccecho.sh ~/.bashrc.d/scripts-needed/
|
||||
chmod 750 ~/.bashrc.d/scripts-needed/brc-script.sh ~/.bashrc.d/scripts-needed/ccecho.sh
|
||||
```
|
||||
|
||||
2. Append the following lines to your `.bashrc` file:
|
||||
@@ -82,7 +81,7 @@ If you prefer a manual installation process, follow these steps:
|
||||
mkdir -p ~/.bashrc.d/scripts-needed ~/.bashrc.d/scripts-enabled ~/.bashrc.d/scripts-available ~/.bashrc.d/scripts-removed
|
||||
```
|
||||
|
||||
4. Restart your shell or source `.bashrc`:
|
||||
4. Reload `.bashrc`:
|
||||
```bash
|
||||
source ~/.bashrc
|
||||
```
|
||||
@@ -125,6 +124,37 @@ The `brc-script.sh` script provides a series of commands to manage your .bashrc
|
||||
brc-script -r
|
||||
```
|
||||
|
||||
## Extra Utilities
|
||||
|
||||
### `ccecho`: Colorful Echo for Enhanced Output
|
||||
|
||||
The project includes a utility script `ccecho.sh` located in `scripts-needed/`, which defines a function `ccecho`. This command allows you to print styled and colored messages to the terminal.
|
||||
|
||||
#### Usage
|
||||
|
||||
```bash
|
||||
ccecho -t green -b black -s bold "Success!"
|
||||
ccecho -t red -s underline "Error!"
|
||||
ccecho "Normal message without styling"
|
||||
```
|
||||
|
||||
#### Available Text Colors
|
||||
`black`, `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`, `bblack`, `bred`, `bgreen`, `byellow`, `bblue`, `bmagenta`, `bcyan`, `bwhite`
|
||||
|
||||
#### Background Colors
|
||||
Same as above, applied with `-b`
|
||||
|
||||
#### Styles
|
||||
`bold`, `dim`, `italic`, `underline`, `blink`, `reverse`, `hidden`, `strike`
|
||||
|
||||
#### Make `ccecho` Globally Available
|
||||
|
||||
If you'd like to use `ccecho` in other terminal sessions or scripts, you can source it in your `.bashrc`:
|
||||
|
||||
```bash
|
||||
source ~/.bashrc.d/scripts-needed/ccecho.sh
|
||||
```
|
||||
|
||||
## Why Use This System?
|
||||
|
||||
Managing a large .bashrc file can become unmanageable, especially when adding multiple custom commands or functions. This system offers a structured approach to handle modular scripts, making it easier to enable or disable specific configurations without manually editing the .bashrc file each time.
|
||||
|
||||
Reference in New Issue
Block a user