Skip to content

Commit

Permalink
The new rebirth!
Browse files Browse the repository at this point in the history
- Now we have a new icon.
- revamped utils, ported modules
- Moved, deletedsome modules
- Corrected README.md
- Updated TODO list, added dir structure
  • Loading branch information
soymadip committed Oct 29, 2024
1 parent 44ee487 commit 1e8b646
Show file tree
Hide file tree
Showing 36 changed files with 596 additions and 417 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
118 changes: 61 additions & 57 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,66 @@
name: Release on Version Change

on:
push:
paths:
- '.version'
push:
paths:
- ".version"

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Read version
id: get_version
run: echo "VERSION=$(cat .version)" >> $GITHUB_ENV

- name: Determine if it's a pre-release
id: pre_release_check
run: |
if [[ "${{ env.VERSION }}" == 0* ]]; then
echo "PRE_RELEASE=true" >> $GITHUB_ENV
echo "RELEASE_NAME=${{ env.VERSION }}-alpha" >> $GITHUB_ENV
else
echo "PRE_RELEASE=false" >> $GITHUB_ENV
echo "RELEASE_NAME=${{ env.VERSION }}" >> $GITHUB_ENV
fi
- name: Get repository name
id: get_repo_name
run: echo "REPO_NAME=$(echo ${{ github.repository }} | cut -d'/' -f2)" >> $GITHUB_ENV

- name: Create a tar.gz archive
run: |
mkdir release
rsync -av --progress . ./release --exclude=".git" --exclude=".github" --exclude="TODO.md" --exclude="README.md"
tar -czvf ./${{ env.REPO_NAME }}.tar.gz -C release .
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION }}
body: "version: ${{ env.VERSION }}."
prerelease: ${{ env.PRE_RELEASE }}
name: ${{ env.RELEASE_NAME }}
files: "${{ env.REPO_NAME }}.tar.gz"
env:
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}

- name: Generate changelog from commits
id: generate_changelog
run: |
CHANGELOG=$(git log -1 --pretty=%B | tr -d '\n' | sed 's/"/\\"/g')
echo "CHANGELOG=${CHANGELOG}" >> $GITHUB_ENV
- name: Update release with changelog
run: |
gh release edit ${{ env.VERSION }} --notes "${{ env.CHANGELOG }}"
env:
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
release:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Read version
id: get_version
run: echo "VERSION=$(cat .version)" >> $GITHUB_ENV

- name: Determine if it's a pre-release
id: pre_release_check
run: |
if [[ "${{ env.VERSION }}" == 0* ]]; then
echo "RELEASE_NAME=${{ env.VERSION }}-alpha" >> $GITHUB_ENV
else
echo "RELEASE_NAME=${{ env.VERSION }}" >> $GITHUB_ENV
fi
- name: Get repository name
id: get_repo_name
run: echo "REPO_NAME=$(echo ${{ github.repository }} | cut -d'/' -f2)" >> $GITHUB_ENV

- name: Create a tar.gz archive
run: |
mkdir release
rsync -av --progress . ./release \
--exclude=".git"\
--exclude=".github"\
--exclude="TODO.md"\
--exclude="README.md"\
--exclude=".editorconfig"\
--exclude=".prettierignore"
tar -czvf ./${{ env.REPO_NAME }}.tar.gz -C release .
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION }}
body: "version: ${{ env.VERSION }}."
prerelease: false
name: ${{ env.RELEASE_NAME }}
files: "${{ env.REPO_NAME }}.tar.gz"
env:
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}

- name: Generate changelog from commits
id: generate_changelog
run: |
CHANGELOG=$(git log -1 --pretty=%B | sed ':a;N;$!ba;s/\n/\\n/g' | sed 's/"/\\"/g')
echo "CHANGELOG=${CHANGELOG}" >> $GITHUB_ENV
- name: Update release with changelog
run: |
gh release edit ${{ env.VERSION }} --notes "$(echo -e "${{ env.CHANGELOG }}")"
env:
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
README.md
TODO.md
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.3
0.5.3
Empty file added Assets/default-config.toml
Empty file.
3 changes: 3 additions & 0 deletions Assets/default-theme.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# UI elements

[ui]
Binary file added Assets/icon-old.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/icon-plain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<p align="center">
<img src="Assets/icon.png">
<img src="Assets/icon.png" width="190px">
<h1 align="center">KireiSakura-Kit</h1>
</p>
<h1 align="center">KireiSakura-Kit</h1>

<p align="center">
KireiSakura-Kit is a library/framework based on <a href="https://www.gnu.org/software/bash">Bash</a> for making powerful shell scripts.
<big>KireiSakura-Kit is a library written in <a href="https://www.gnu.org/software/bash">Bash</a> for making powerful shell scripts.</big>
</p>
<br>

> "KireiSakuraKit" is combination of two Japanese words, "Kirei" and "Sakura," along with the suffix "Kit".
> "KireiSakura-Kit" is combination of two Japanese words, "Kirei" and "Sakura," along with the suffix "Kit".</br>
> `Kirei(綺麗)` means "clean" & `Sakura(桜)` refers to cherry blossoms. Together, "KireiSakura-Kit" could be interpreted as a library that emphasizes a beautiful and clean design inspired by the elegance of cherry blossoms.
## Features
Expand All @@ -26,12 +26,12 @@

- Follow below steps to Install Kireisakura-Kit

### For system wide:-
### For system wide

- In terminal run:-

```bash
curl -L https://raw.githubusercontent.com/soymadip/KireiSakura-Kit/refs/heads/install/install.sh | bash -s -- -ds
curl -L https://raw.githubusercontent.com/soymadip/KireiSakura-Kit/refs/heads/install/install.sh | bash -s
```

- Then in your script, include this line at the top:-
Expand All @@ -40,25 +40,28 @@
eval "$(kireisakura --init)"
```

### Or directly in script:-
### For directly using in script

- This will check if Kit is installed or download & setup KireiSakura-Kit.

```bash
if command -v kireisakura &> /dev/null; then
eval "$(kireisakura --init)"
else
echo "> Installing KireiSakura-Kit"
curl -sL https://raw.githubusercontent.com/soymadip/KireiSakura-Kit/refs/heads/install/install.sh -o kirestaller.sh
bash kirestaller.sh
curl -sSL https://raw.githubusercontent.com/soymadip/KireiSakura-Kit/refs/heads/install/install.sh -o kirestaller.sh
bash kirestaller.sh -ds
fi
```

## Methods & Docs

- Docs To be done.
- Run `kireisakura -h` for help.
- See [my dotfiles](https://github.com/soymadip/Dotfiles/blob/dotfiles/install/start.sh) for example.
- See [my dotfiles](https://github.com/soymadip/Dotfiles) for example.

## Warning

- MAJOR CHANGES ARE BEING MADE as this project is in alpha, so be careful.
- As of now, some part of this library is Arch-linux centric, but can be extended to any distro.
- Contribute if you find this useful and wanna make this more powerful.
42 changes: 42 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,65 @@
## For Initial Release:

- [x] Make `init.sh` in kit root for initialization.

- [x] Make setup command: `eval "$(kireisakura --init)"`

- [x] Make other commands:
- `kireisakura -h`
- `kireisakura -v`
- `kireisakura -d` etc.
- [x] Make a test script.

- [x] Make install script.

- [x] Better directory structure.

- [ ] Make a clearer Design guide.

- [ ] Revamp project.
- [x] Better directory structure.
- [x] Clearer naming conventions.
- [ ] Make old Modules compatible.

## For Another Time:

- [x] Implement Auto-Update.
- [ ] Make use of log file in more functions (for more detailed logs).
- [ ] Check if core functions & dependency functions are loaded and set that script load flag true using a variable.
- [ ] Config file support.
- [ ] toml as format?
- [ ] use of [yq][yq_cg]?
- [ ] Add `-q` or `--quiet` flag to all possible functions.
- [ ] Write documentation (help needed).
- [ ] Enable completions (still thinking if useful):
- Make script.
- Source the file.
- In install script: `printf "echo \"fpath+=(\"${kirei_dir}/completions\")\" >> \"${zsh_rc}\""`

</br></br>


# Directory structure:

```shell
./
|- Assets/ - holds icon, default configs etc..
|- bin/kireisakura - enables command, help message, version message, init system, updater.
|- core/
| |- _loader - loads configs & modules.
| |- logging - enables logging.
| |- test - test script to verify the setup.
| |- ui - holds ui components.
| |- utils - holds core functions.
| └─ updater - as the name suggests :)
|
|- modules/ - holds modules
└- .version - vesion number

```





[yq_cg]: [yq](https://chatgpt.com/share/671ab466-aaf0-8001-ba21-ae748636e88b)
47 changes: 38 additions & 9 deletions bin/kireisakura
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,24 @@ YELLOW='\033[1;33m'
GREEN='\033[0;32m'
RESET='\033[0m'

KIT_LOGO="$(
cat <<"EOF"
_ ___ _ ____ _ _ ___ _
| |/ (_)_ __ ___(_) ___| __ _| | ___ _ _ __ __ _ | |/ (_) |_
| ' /| | '__/ _ \ \___ \ / _` | |/ / | | | '__/ _` |_____| ' /| | __|
| . \| | | | __/ |___) | (_| | <| |_| | | | (_| |_____| . \| | |_
|_|\_\_|_| \___|_|____/ \__,_|_|\_\\__,_,|_| \__,_| |_|\_\_|\__|
EOF
)"


#_____________________________________FUNCTIONS_____________________________________________


# Log function
logf() {
local message="$1"
local timestamp=$(date '+%Y-%m-%d %H:%M:%S')
local timestamp="[$(date '+%Y.%m.%d %H:%M:%S')] "

# Replace '\n' with actual newlines
local formatted_message=$(echo -e "$message")
Expand All @@ -24,6 +35,22 @@ logf() {
}


clearx() {
if [[ "$(uname)" == "Darwin" ]]; then
clear
else
clear -x
fi
}


print_header() {
clearx
printf "echo -e '$KIT_LOGO\n\n"
sleep 0.3
}


# For no arguments
show_man() {
local opt=${1:-" "}
Expand Down Expand Up @@ -119,6 +146,7 @@ init() {

printf "\n\n" >>"$log_file"
logf "====================== NEW SESSION =======================\n"
logf "Started in: $(pwd)"
logf "Initialization started."
printf "echo -e '\\n${YELLOW}[ INIT ]-> Starting Initialization..${RESET}\\n\\n'\n"

Expand Down Expand Up @@ -180,26 +208,26 @@ init() {
logf "Loading core....."
printf "echo \"${YELLOW}[!]-> Loading core.${RESET}\" \n"
printf "source \"\$kirei_core\" \n"
printf "log 'Loaded core.' success \n"
printf "log.success 'Loaded core.' \n"
logf "Loaded core."

# This was the issue part
printf "sleep 1\n"
printf "log \"Checking cache directory.....\" inform \n"
printf "check_dir \"\${kirei_cache_dir}\" -q \n"
printf "log \"Cache directory exists.\" success \n"
printf "log.warn \"Checking cache directory.....\"\n"
printf "check-dir \"\${kirei_cache_dir}\" -q \n"
printf "log.success \"Cache directory exists.\"\n"
printf "echo "" \n"
printf "log \"KireiSakura-Kit v${kit_version}\" \n"
printf "sleep 1\n"
printf "echo \" \\n \" \n"
printf "log \"Initialization complete.\" success INIT\n"
printf "log.success \"Initialization complete.\" INIT\n"
logf "Initialization complete."
}


run_tester() {
clear -x
bash "$kirei_dir/core/_test.sh" || exit 1
bash "$kirei_dir/core/test.sh" || exit 1
}


Expand All @@ -212,7 +240,7 @@ kirei_core="$kirei_core_dir/_loader.sh"
kirei_module_dir="$kirei_dir/modules"

cache_dir="${CACHE_DIR:-$HOME/.cache/KireiSakura-Kit}"
log_file="${LOG_FILE:-KireiSakura-Kit.log}"
log_file="${cache_dir}/${LOG_FILE_NAME:-KireiSakura-Kit.log}"

init_flag=false
is_cstm_kit_dir=false
Expand Down Expand Up @@ -271,5 +299,6 @@ done

# Perform setup if --init flag is set
if [ "$init_flag" = true ]; then
init "$kirei_dir"
mkdir -p "$cache_dir"
init "$kirei_dir"
fi
Loading

0 comments on commit 1e8b646

Please sign in to comment.