Skip to content

Commit

Permalink
Introduce bashpal to the project
Browse files Browse the repository at this point in the history
New debian package (created by me)
  • Loading branch information
endormi authored Apr 6, 2024
2 parents 8c13059 + 914c305 commit 57b76f0
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 113 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
ruby-version: 2.7

- name: Install rspec
run: gem install rspec -v 3.12.0
Expand Down
5 changes: 1 addition & 4 deletions GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ for example, `-c` and `-f`, to separate scripts into folders.
4 -i -prv: python and ruby version
4 -i -r: root (check if you are root or not)
4 -i -s: display computer space, uptime and number of processes running
4 -o -a: add alias
4 -o -b: print text in ASCII art (submodule)
4 -o -cdp: convert doc to pdf
4 -o -def: default web browser
Expand Down Expand Up @@ -106,9 +105,7 @@ tilux/sys/file_folder/fs.o
```

If you prefer running specific scripts without launching Tilux itself,
you can execute them individually as shown above. Additionally, if you frequently
use certain scripts, you can add them to your alias for easier access.
To do this, you can use the `sys/other/add_alias` script.
you can execute them individually as shown above.

## Running with Docker

Expand Down
5 changes: 1 addition & 4 deletions docs/source/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ for example, `-c` and `-f`, to separate scripts into folders.
4 -i -prv: python and ruby version
4 -i -r: root (check if you are root or not)
4 -i -s: display computer space, uptime and number of processes running
4 -o -a: add alias
4 -o -b: print text in ASCII art (submodule)
4 -o -cdp: convert doc to pdf
4 -o -def: default web browser
Expand Down Expand Up @@ -100,9 +99,7 @@ tilux/sys/file_folder/fs.o
```

If you prefer running specific scripts without launching Tilux itself,
you can execute them individually as shown above. Additionally, if you frequently
use certain scripts, you can add them to your alias for easier access.
To do this, you can use the `sys/other/add_alias` script.
you can execute them individually as shown above.

## Running with Docker

Expand Down
1 change: 0 additions & 1 deletion download/download_scripts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ scripts=(
"sys/info/bit.sh"
"sys/info/ip.rb"
"sys/info/root.rb"
"sys/other/add_alias.sh"
"sys/other/parse_date.rb"
)

Expand Down
3 changes: 0 additions & 3 deletions man/tilux.1
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,6 @@ root (check if you are root or not).
.BR 4 " " -i " " -s
display computer space, uptime and number of processes running.
.TP
.BR 4 " " -o " " -a
add alias.
.TP
.BR 4 " " -o " " -b
print text in ASCII art (submodule).
.TP
Expand Down
16 changes: 10 additions & 6 deletions scripts/add_alias
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

[ ! -d scripts ] && cd ..

source scripts/utils/bash_aliases
source scripts/utils/bashpal_suggestion

alias_name="tilux"
check_alias_exists $alias_name
cmd="cd $PWD && ./$alias_name"

echo "alias $alias_name='cd $PWD && ./$alias_name'" >> $bash_aliases_file
echo -e "Added ${alias_name} to ${bash_aliases_file}"

prompt_for_new_shell_session
if ! command -v bashpal &>/dev/null; then
bashpal_suggestion
bash_aliases_file=~/.bash_aliases
echo "alias $alias_name='$cmd'" >> $bash_aliases_file
echo -e "Added ${alias_name} to ${bash_aliases_file}"
else
bashpal -a $alias_name -c "$cmd"
fi
16 changes: 10 additions & 6 deletions scripts/add_alias_venv
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

[ ! -d scripts ] && cd ..

source scripts/utils/bash_aliases
source scripts/utils/bashpal_suggestion

alias_name="tvenv"
check_alias_exists $alias_name
cmd=". $PWD/venv/bin/activate"

echo "alias $alias_name='. $PWD/venv/bin/activate'" >> $bash_aliases_file
echo -e "Added ${alias_name} to ${bash_aliases_file}"

prompt_for_new_shell_session
if ! command -v bashpal &>/dev/null; then
bashpal_suggestion
bash_aliases_file=~/.bash_aliases
echo "alias $alias_name='$cmd'" >> $bash_aliases_file
echo -e "Added ${alias_name} to ${bash_aliases_file}"
else
bashpal -a $alias_name -c "$cmd"
fi
17 changes: 8 additions & 9 deletions scripts/add_project_to_path
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

[ ! -d scripts ] && cd ..

source scripts/utils/bash_aliases
source scripts/utils/bashpal_suggestion

directory=$PWD

if grep -Fxq "export PATH=\$PATH:$directory" $bash_aliases_file || alias $directory &>/dev/null; then
echo "Directory or alias already exists in PATH!"
exit
if ! command -v bashpal &>/dev/null; then
bashpal_suggestion
bash_aliases_file=~/.bash_aliases
echo "export PATH=\$PATH:$directory" >> $bash_aliases_file
echo "Added ${directory} PATH to ${bash_aliases_file}"
else
bashpal -p $directory
fi

echo "export PATH=\$PATH:$directory" >> $bash_aliases_file
echo "Added ${directory} PATH to ${bash_aliases_file}"

prompt_for_new_shell_session
29 changes: 0 additions & 29 deletions scripts/utils/bash_aliases

This file was deleted.

17 changes: 17 additions & 0 deletions scripts/utils/bashpal_suggestion
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Seems redundant to add an util for bashpal suggestion
# but I want to keep at least some support for alias and PATH
# creation even if bashpal isn't installed.

# Hence why I'm only reusing a small part of the original code.
bashpal_suggestion() {
echo "Doesn't check for duplicates nor creates the file ~/.bash_aliases."
echo "I suggest installing bashpal."
echo -e "\nsudo add-apt-repository ppa:endormi/ppapp && sudo apt update && sudo apt install bashpal\n"

read -p "Do you want to continue? (Y/n) " continue
continue="$(echo ${continue} | tr 'A-Z' 'a-z')"

[ "$continue" != "y" ] && [ "$continue" != "yes" ] && echo "Exiting..." && exit
}
47 changes: 0 additions & 47 deletions sys/other/add_alias.sh

This file was deleted.

1 change: 0 additions & 1 deletion tools/tilux/command_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
end
},
'-o': {
'-a': -> { TiluxHelpers.sys("bash #{PATH}/sys/other/add_alias.sh tilux") },
'-b': lambda do
system('clear')
print `python3 -c "from tools.logos import Logo; Logo('Bashcii');"`
Expand Down
2 changes: 0 additions & 2 deletions tools/tilux/print_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ def systemin_print

def systemo_print
puts '::OTHER::'
puts '-a: add alias'
puts '-b: print text in ASCII art (submodule)'
puts '-cdp: convert doc to pdf'
puts '-def: default web browser'
Expand Down Expand Up @@ -153,7 +152,6 @@ def help_print
puts '4 -i -prv: python and ruby version'
puts '4 -i -r: root (check if you are root or not)'
puts '4 -i -s: display computer space, uptime and number of processes running'
puts '4 -o -a: add alias'
puts '4 -o -b: print text in ASCII art (submodule)'
puts '4 -o -cdp: convert doc to pdf'
puts '4 -o -def: default web browser'
Expand Down

0 comments on commit 57b76f0

Please sign in to comment.