Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/coerschkes/co-scripts

A Collection of all my scripts I use during development and for quality of life
https://github.com/coerschkes/co-scripts

framework shell shell-scripts

Last synced: 16 days ago
JSON representation

A Collection of all my scripts I use during development and for quality of life

Awesome Lists containing this project

README

        



co-scripts


A Collection of all my scripts I use during development and for quality of life


Table of Contents



  1. About The Project


  2. Getting Started

  3. Usage

  4. Roadmap

## About The Project

This is a collection of shellscripts for linux environments. I use them to update dependencies, print out stuff, managing my aliases, etc.. With this collection ships a simple framework for developing new scripts and registering aliases for the scripts.

## Getting Started

1. Checkout the project
```sh
git clone https://github.com/coerschkes/co-scripts.git
```
2. Set the env-variable "SCRIPT_DIR" to the root of this project
```sh
export SCRIPT_DIR=
```
> **_note_**
> For permanent access and functionality of the scripts, put the export statement into .bashrc or .profile
3. Run import-all.sh to register aliases for all important scripts
```sh
./import-all.sh
```
4. Restart your shell and there you go!

> **_note_**
> If you have a .bash_aliases file and use it to manage your aliases don't run the import script cause it will overwrite the existing file. To use your aliases along with this framework move the alias definitions to .bashrc or .profile before running the import script.

## Usage

The project differences between two types of scripts, visible and invisible. Invisible scripts start with an underscore ('\_') and are not recognized by the import or the print script. These scripts are used as helpers or library scripts. Visible scripts get imported and printed and are created by calling generate-script-template.sh or the alias:

```sh
new-script
```

This creates a new script with a print() and an alias() function. To use this framework with autogenerated aliases and printing, these two functions are **_mandatory_** in every **_visible_** script - otherwise you get weird error messages cause these functions will get called.

To get an overview of all visible scripts available and all aliases they ship with simply execute the print-all.sh script or the alias:

```sh
ps
```

Whenever you add a new visible script to the directory structure, simply execute import-all.sh or the alias:

```sh
is
```

This will import the new script, register it with the alias returned from the **_alias_** function and print the usage by executing **_print_**. Before you can use your new script as alias you have to restart your shell.

> **_note_**
> If you add another folder to the structure or want to add specific scripts to printing/importing you have to edit the import-all/print-all script and add the designated path. This may work different in the future (I'm planning on tweaking this a little) but for now you gotta go with that.

## Roadmap

- [ ] recursive script detection
- [X] description() for every script
- [X] print description() instead of usage when printing all
- [ ] calculate max-len for all script-aliases and print afterwards with fixed max-len
- [ ] improve template and template generation
- [X] standard script algorithm with switch
- [ ] script-scheme validator
- ...