Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • keegoid/quick-config
1 result
Show changes
Commits on Source (4)
Loading
Loading
@@ -30,6 +30,7 @@ REPO3="$QC_CONFIG/subl/subl.conf"
REPO4="$QC_CONFIG/mutt/colors/mutt-colors-solarized-dark-16.muttrc"
REPO5="$QC_CONFIG/vim/vim.conf"
REPO6="$QC_CONFIG/git/gitignore_global"
REPO7="$QC_CONFIG/bashrc/ps1.conf"
 
# -------------------------- BACKUPS
 
Loading
Loading
@@ -204,11 +205,56 @@ qc_set_autojump() {
lkm_debug
}
 
# -------------------------- SET PS1
qc_set_ps1() {
local repo_url="$1"
local src_cmd="$2"
local conf_file="$CONF1"
local repo_file="$REPO7"
local repo_dir
local repo_name
local configured=1
repo_dir=$(lkm_trim_shortest_right_pattern "$REPO7" "/")
repo_name=$(lkm_trim_longest_left_pattern "$repo_dir" "/")
# update or clone repository
if [ -d "$repo_dir" ]; then
(
cd "$repo_dir" || exit
echo "checking for updates: $repo_name"
git pull
)
else
git clone "$repo_url" "$repo_dir"
fi
# check if already added, else set source command in conf_file
if grep -q "bashrc/ps1.conf" "$conf_file" >/dev/null 2>&1; then
echo "already added custom PS1 file"
else
lkm_pause "Press [Enter] to configure PS1 variable for gnome-terminal" true
# shellcheck disable=SC1090
sed -i.bak -e '0,/PS1/s//#PS1/' -e "/\"\$color_prompt\" = yes/ a $src_cmd" "$conf_file" && source "$conf_file" && configured=0
fi
# success message
if [ $? -eq 0 ] && [ "$configured" -eq 0 ]; then
lkm_success "configured: $conf_file with custom PS1 variable"
echo "Close and reopen the terminal to see the new prompt string."
fi
# shellcheck disable=SC2034
RET="$?"
lkm_debug
}
# -------------------------- UNSET FUNCTIONS
 
# unset the various functions defined during execution of the script
qc_reset() {
unset -f qc_reset qc_do_backup qc_set_code_config qc_set_git_config qc_set_terminal_history qc_set_autojump
unset -f qc_reset qc_do_backup qc_set_code_config qc_set_git_config qc_set_terminal_history qc_set_autojump qc_set_ps1
}
 
# -------------------------- MAIN
Loading
Loading
@@ -247,6 +293,9 @@ qc_set_terminal_history "$CONF2"
qc_set_autojump "$CONF1" \
"\n# source autojump file\nif [ -f $REPO1 ]; then\n . $REPO1\nfi"
 
qc_set_ps1 "https://gist.github.com/13482742b6140ec0ffbc818173805889.git" \
"# source PS1 file\n if [ -f $REPO7 ]; then\n . $REPO7\n fi"
qc_reset
 
} # this ensures the entire script is downloaded #
Loading
Loading
@@ -15,7 +15,7 @@
{ # this ensures the entire script is downloaded #
 
# -------------------------- SETUP PARAMETERS
[ -z "$NVM_V" ] && NVM_V=0.33.2
[ -z "$NVM_V" ] && read -rep "NVM version to use: " -i "0.33.2" NVM_V
 
# -------------------------- MISSING PROGRAM CHECKS
 
Loading
Loading
Loading
Loading
@@ -14,7 +14,8 @@
 
# install Sublime Text
qc_install_subl() {
local subl_v='3126'
local subl_v
[ -z "$subl_v" ] && read -rep "Sublime Text 3 version to use: " -i "3126" subl_v
local subl_url="https://download.sublimetext.com/sublime-text_build-${subl_v}_amd64.deb"
 
if lkm_not_installed "subl"; then
Loading
Loading