Skip to content

Commit

Permalink
feat: Introduced libevent.sh with functions (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsanima authored Feb 6, 2024
1 parent 373adb6 commit 5470427
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ max_line_length = 80
insert_final_newline = false
max_line_length = off

[{Makefile,.gitconfig,.gitcredentials}]
[{Makefile,.gitattributes,.gitconfig,.gitcredentials,.gitmessage,.gitmodules}]
indent_size = 8
indent_style = tab
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# dotfiles

These dotfiles include configuration settings for various tools I use, such as [Oh My Zsh](https://github.com/ohmyzsh/ohmyzsh/) for _Linux_ terminal customization, [Oh My Posh](https://github.com/JanDeDobbeleer/oh-my-posh/) for _Windows_ terminal customization, EditorConfig, and many more.
These dotfiles include configuration settings for various tools like [Oh My Zsh](https://github.com/ohmyzsh/ohmyzsh/) and [Oh My Posh](https://github.com/JanDeDobbeleer/oh-my-posh/) for terminal customization, custom libraries, and many more.

Additionally, this repository contains template files that I use for other repositories, such as GitHub Actions Workflow, Dependabot, syncing labels, or the other commonly used dotfiles.
Additionally, this repository contains template files that can be used for other repositories, such as _GitHub Actions Workflow_, _Dependabot_, _Labeler_, or other commonly used dotfiles.

## Getting started
## Getting Started

Make sure you have [nerd-fonts](https://github.com/ryanoasis/nerd-fonts/) installed in your system.
Ensure that you have [nerd-fonts](https://github.com/ryanoasis/nerd-fonts/) installed on your system.

### Installation on Linux

Clone this repository and type the `./install.sh` command in the **Shell** terminal to perform the installation in _Linux_ system.
Clone this repository and execute the `./install.sh` script in the _Shell_ terminal to install the configurations on **Linux**.

### Installation on Windows

Clone this repository and type the `.\install.ps1` command in the **PowerShell** terminal to perform the installation in _Windows_ system.
Clone this repository and execute the `.\install.ps1` script in the _PowerShell_ terminal to install the configurations on **Windows**.
6 changes: 1 addition & 5 deletions config/aliasrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2024 MDSANIMA DEV. All rights reserved.
# Licensed under the MIT license.

# This is a custom aliases definitions file for Linux system.
# This is a custom aliases definitions file for GNU/Linux systems.


# Aliases for internal hosts
Expand All @@ -17,10 +17,6 @@ alias jet1="ssh mdsanima@192.168.1.24"
alias jet2="ssh mdsanima@192.168.1.30"
alias macb="ssh mdsanima@192.168.1.44"

# Aliases for shell scripts
alias weahter="mdsanima-weather"
alias pogoda="mdsanima-weather"

# Aliases for Kubernetes
alias k="kubectl"

Expand Down
24 changes: 10 additions & 14 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
#!/bin/sh
#!/bin/bash

# Copyright (c) 2024 MDSANIMA DEV. All rights reserved.
# Licensed under the MIT license.

# This is a installation script for MDSANIMA DEV dotfiles on Linux terminal configuration.
# Installation script for dotfiles for GNU/Linux systems, like Debian or Ubuntu.


# Import necessary modules
. "$PWD/modules/mdsanima-shell/private/banner.sh"
. "$PWD/modules/mdsanima-shell/private/event.sh"
. "$PWD/modules/mdsanima-shell/private/print.sh"
. "$PWD/modules/mdsanima-shell/public/colors.sh"
# Import necessary libraries
source "$PWD/lib/mdsanima-shell/libcolor.sh"
source "$PWD/lib/mdsanima-shell/libprint.sh"

# List of packages to install
APT_PACKAGES="python3-pip zsh powerline fonts-powerline zsh-theme-powerlevel9k"
Expand All @@ -19,13 +17,11 @@ APT_PACKAGES_OPTIONAL="curl git htop vim tmux mc neofetch cmatrix ffmpeg"
# Get the current tag from the Git repository
CURRENT_GIT_TAG=$(git describe --tags)

dotfiles_installer() {
__mds_ascii_banner
__mds_event_log $BLUE "MDSANIMA DEV" "dotfiles $CURRENT_GIT_TAG"
__mds_color_print " "
__mds_color_print -fg $WHITE "This installer is only available for Linux system."
__mds_color_print " "
__mds_color_print -fg $GRAY "Copyright (c) 2024 MDSANIMA DEV. All rights reserved. Licensed under the MIT license."
function dotfiles_installer() {
print::color -fg ${WHITE} -bg ${BLUE} -b -n " MDSANIMA DEV "
print::color -fg ${BLUE} " dotfiles ${CURRENT_GIT_TAG}\n"
print::color -fg ${WHITE} "This installer is only available for GNU/Linux systems, like Debian or Ubuntu.\n"
print::color -fg ${GRAY} "Copyright (c) 2024 MDSANIMA DEV. All rights reserved. Licensed under the MIT license."
}

dotfiles_installer
2 changes: 2 additions & 0 deletions lib/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!-- This file is meant for maintaining the folder structure and will be committed. -->
<!-- You can delete it later once there is content found in this folder. -->
6 changes: 4 additions & 2 deletions lib/mdsanima-shell/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# mdsanima-shell

This is the documentation for the `mdsanima-shell` library, which is used to execute _Shell Scripts_ on **GNU/Linux** systems, like _Debian_ or _Ubuntu_.
This is the documentation for the `mdsanima-shell` library.

The functions in this library are designed to manipulate the state of the computer and are commonly used in my `dotfiles` and other projects.
## Introduction

This library contains functions thats help to execute _Shell Scripts_ on **GNU/Linux** systems, like _Debian_ or _Ubuntu_.
3 changes: 1 addition & 2 deletions lib/mdsanima-shell/libcolor.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Copyright (c) 2024 MDSANIMA DEV. All rights reserved.
# Licensed under the MIT license.

# Defining default color names with color code number thats is used in the
# terminal script output.
# This library is designed to define color names with color code number.


# Generic
Expand Down
31 changes: 31 additions & 0 deletions lib/mdsanima-shell/libevent.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright (c) 2024 MDSANIMA DEV. All rights reserved.
# Licensed under the MIT license.

# This library is designed to print event names in colors. Events are displayed
# with bold black text representing the event name and a selected color
# background for emphasis.


function event::debug() {
print::color -fg ${BLACK} -bg ${GRAY} -b " DEBUG "
}

function event::dev() {
print::color -fg ${BLACK} -bg ${BLUE} -b " DEV "
}

function event::error() {
print::color -fg ${BLACK} -bg ${RED} -b " ERROR "
}

function event::info() {
print::color -fg ${BLACK} -bg ${SKY} -b " INFO "
}

function event::success() {
print::color -fg ${BLACK} -bg ${LIME} -b " SUCCESS "
}

function event::warning() {
print::color -fg ${BLACK} -bg ${ORANGE} -b " WARNING "
}
12 changes: 6 additions & 6 deletions lib/mdsanima-shell/libprint.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Copyright (c) 2024 MDSANIMA DEV. All rights reserved.
# Licensed under the MIT license.

# This library is designed for printing the text in colors and other styles.
# This library is designed to print text in colors and other styles.


################################################################################
# This function provides a simple way to printing the text with colors on the
# terminal bash script.
#-------------------------------------------------------------------------------
# This function provides a simple way to print text with colors on the terminal
# bash script outputs.
#
# Arguments:
# -fg <color> Foreground color number or name, optional, default to none
Expand All @@ -20,8 +20,8 @@
# print::color -fg <color> -bg <color> -bold -italic -nonewline <text>
# print::color -fg 15 -bg 9 -bold "Bold white text on red background"
# print::color -fg 196 -b -italic "Bold italic red text"
# print::color -fg WHITE -bg RED "White text on red background"
################################################################################
# print::color -fg ${WHITE} -bg ${RED} "White text on red background"
#-------------------------------------------------------------------------------
function print::color() {
local fg_color
local bg_color
Expand Down

0 comments on commit 5470427

Please sign in to comment.