Browse Source

first commit

main
pvincent 2 months ago
parent
commit
43e544f946
  1. 8
      .vscode/extensions.json
  2. 25
      .vscode/settings.json
  3. 59
      main

8
.vscode/extensions.json

@ -0,0 +1,8 @@
{
"recommendations": [
"jgclark.vscode-todo-highlight",
"waderyan.gitblame",
"mads-hartmann.bash-ide-vscode",
"mkhl.shfmt"
]
}

25
.vscode/settings.json

@ -0,0 +1,25 @@
{
// -----------------256-color ANSI SUPPORT ----------------
"terminal.integrated.shellIntegration.enabled": false,
"terminal.integrated.minimumContrastRatio": 1,
"terminal.integrated.drawBoldTextInBrightColors": false,
"workbench.colorCustomizations": {
"terminal.background": "#1f1f1f",
"terminal.ansiYellow": "#b38210" //BROWN UNIX ANSI
},
"workbench.colorTheme": "Default Dark Modern",
"editor.formatOnSave": true,
"editor.tabSize": 2, // Use 2 spaces for indentation
"editor.insertSpaces": true,
"todohighlight.enableDiagnostics": true,
"todohighlight.include": [
"**/*.js",
"**/*.html",
"**/*.css",
"**/*.rb",
"**/*.txt",
"**/*.md",
"**/*.erb",
"**/*.rake"
],
}

59
main

@ -0,0 +1,59 @@
#!/usr/bin/env bash
# global variables
# functions
function bashrc_count_lines {
wc -l "$HOME/.bashrc" | cut -d' ' -f1
}
function bashrc_watch_start {
if [ -n "${BASHRC_LINES+set}" ]; then
echo "provided so far BASHRC_LINES=$BASHRC_LINES"
else
echo 'count lines of .bashrc'
BASHRC_LINES=$(bashrc_count_lines)
fi
}
function bashrc_watch_end {
bashrc_lines=$(bashrc_count_lines)
if [[ "$BASHRC_LINES" -lt "$bashrc_lines" ]]; then
echo '*****************************'
echo '* BASHRC has evolved *'
echo '* please execute: *'
echo '* *'
echo "* source \$HOME/.bashrc *"
echo '* *'
echo '*****************************'
else
echo 'everything is fine!'
fi
}
function bashrc_env_sync {
env_var="$1"
env_value="$2"
if printenv | grep -q "$env_var"; then
real_value=$(eval "echo \$$env_var")
echo "success for $env_var = $real_value"
else
session_line="export ${env_var}=${env_value}"
append_or_replace "^${session_line}.*" "$session_line" "$HOME/.bashrc" &>/dev/null
eval "$session_line"
set +e
eval "BASHRC_LINES=$BASHRC_LINES $0"
exit $?
fi
}
# main
set -Eeu
bashrc_watch_start
echo 'init'
bashrc_env_sync 'SESSION_RESTART' true
echo 'suite'
bashrc_watch_end
Loading…
Cancel
Save