Compare commits

...

4 Commits

11 changed files with 217 additions and 134 deletions

View File

@ -9,116 +9,131 @@ function jaaENV {
echo " jaaENV --save …to_save (example: jaaENV --save nodejs php)"
echo ""
echo "Description:"
echo " - Without arguments loads infos from '.jaaENV'"
echo " - 'ls' shows supported options to auto load"
echo " - 'save' cerates config file '.jaaENV'"
echo " - Without arguments, loads info from '.jaaENV'"
echo " - 'ls' shows supported options to auto-load"
echo " - 'save' creates a config file '.jaaENV'"
echo ""
echo "Usage '.jaaENV' files: "
echo " typical: '\nphp=5.6\nnodejs=16.13.0'"
echo " link: '. ../.jaaENV' … use settings from parent folder"
echo " Options:"
echo " 'android_home': Exports 'ANDROID_HOME' (uses 'ANDROID_HOME_BAK') instead of new 'ANDROID_SDK_ROOT'. Value can be anything (use '1')."
echo " 'jdk': Exports 'JAVA_HOME' based on wanted version (currently 11/1.8)"
echo " 'android_home': Exports 'ANDROID_HOME' (uses 'ANDROID_HOME_BAK') instead of 'ANDROID_SDK_ROOT'. Value can be anything (use '1')."
echo " 'jdk': Exports 'JAVA_HOME' based on the wanted version (currently 11/1.8)"
echo " 'nodejs'|'php': NodeJS/PHP versions"
echo " 'gradle': Cordova uses folder scoped → so unnecesarly"
echo " 'gradle': Cordova uses folder-scoped → so unnecesarly"
echo ""
echo "Install: "
echo " gradle ⇒ https://sdkman.io/"
echo " node ⇒ https://github.com/nvm-sh/nvm"
echo " php ⇒ http://jdem.cz/fgyu56 + https://deb.sury.org/"
echo " php ⇒ \`update-alternatives\` + https://deb.sury.org/"
echo " java ⇒ \`update-alternatives\`"
echo ""
echo "Tips:"
echo " sudo update-alternatives --set php /usr/bin/php\$php"
return 0
fi
if [ "$1" = "--save" ]; then
if [ "$1" == "--save" ]; then
shift
rm -vi .jaaENV
while test $# -gt 0
do
while [ $# -gt 0 ]; do
case "$1" in
nodejs|node)
local nodejs_version=$(node --version)
echo "nodejs=${nodejs_version:1}" >> .jaaENV
echo "nodejs=$(node --version | cut -c2-)" >> .jaaENV
;;
gradle)
local gradle_version=$(gradle --version | head -n 3 | tail -n 1 | §awk 2)
echo "gradle=$gradle_version" >> .jaaENV
echo "gradle=$(gradle --version | awk '/Gradle/ {print $2}')" >> .jaaENV
;;
php)
local php_version=$(php --version | head -n 1 | §awk 2)
echo "php=$php_version" >> .jaaENV
echo "php=$(php --version | awk '/^PHP/ {print $2}')" >> .jaaENV
;;
java)
local java_version=$(java -version 2>&1 | head -n 1 | cut -d'"' -f2 | cut -d'.' -f1)
local java_version=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}')
if [[ "$java_version" == 1.8* ]]; then
java_version=8
else
java_version=$(echo "$java_version" | cut -d'.' -f1)
fi
echo "java=$java_version" >> .jaaENV
;;
*)
echo "unknown '$1' skipped"
echo "Unknown '$1' skipped"
;;
esac
shift
done
return 0
fi
if [ "$1" = "--ls" ]; then
echo ":: nvm ls ::\n"
nvm ls
echo ":: find /usr/bin/ -name php* ::\n"
find /usr/bin/ -name php*
echo ":: sdk ls gradle | cat :: "
sdk ls gradle | cat
if [ "$1" == "--ls" ]; then
echo ":: nvm ls --no-alias ::"
nvm ls --no-alias
echo ":: update-alternatives --list php ::"
update-alternatives --list php
echo ":: update-alternatives --list java ::"
update-alternatives --list java
echo ":: sdk ls gradle | grep -E '\*|>' :: "
sdk ls gradle | grep -E '\*|>'
return 0
fi
if [ -f "compose.yaml" ]; then
jdk=$(grep -Po 'VERSION_JAVA=\K.*' compose.yaml)
nodejs=$(grep -Po 'VERSION_NODEJS=\K.*' compose.yaml)
else
elif [ -f ".jaaENV" ]; then
. ./.jaaENV
else
echo 'No env file `compose.yaml` or `.jaaENV`'
return 1
fi
if [ ! -z ${java+x} ]; then
[[ "$java" == "8" ]] && java=1.8
local java_local=$(java -version 2>&1 | head -n 1 | cut -d'"' -f2)
local java_local=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}')
if [[ "$java_local" != "$java"* ]]; then
[[ "$java" == "1.8" ]] && java=8
echo "java $java$java_local"
local v="/usr/lib/jvm/java-$java-openjdk-amd64/"
[[ "$java" == "8" ]] && local vv="jre/" || local vv=""
sudo update-alternatives --set java ${v}${vv}bin/java
echo "Switching Java version: $java$java_local"
local java_path="/usr/lib/jvm/java-$java-openjdk-amd64/"
[[ "$java" == "8" ]] && java_path+="jre/"
sudo update-alternatives --set java "${java_path}bin/java"
local javac=$(update-alternatives --list javac | grep java-$java)
[ $javac ] && sudo update-alternatives --set javac $javac
[ -n "$javac" ] && sudo update-alternatives --set javac "$javac"
sudo -k
fi
export JAVA_HOME=$(update-alternatives --display java | grep momentálně | §awk 5 | cut -d \/ -f1-5)/
echo \$JAVA_HOME=$JAVA_HOME
export JAVA_HOME=$(readlink -f $(which java) | cut -d '/' -f1-5)/
echo "\$JAVA_HOME=$JAVA_HOME"
fi
if [ ! -z ${android_home+x} ]; then export ANDROID_HOME=$ANDROID_HOME_BAK; echo "\$ANDROID_HOME=$ANDROID_HOME"; else unset ANDROID_HOME; echo "\$ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT"; fi
if [ ! -z ${android_home_is_sdk+x} ]; then export ANDROID_HOME=$ANDROID_SDK_ROOT; echo "\$ANDROID_HOME=$ANDROID_HOME"; fi
if [ ! -z ${android_home+x} ]; then
export ANDROID_HOME=$ANDROID_HOME_BAK
echo "\$ANDROID_HOME=$ANDROID_HOME"
else
unset ANDROID_HOME
echo "\$ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT"
fi
if [ ! -z ${android_home_is_sdk+x} ]; then
export ANDROID_HOME=$ANDROID_SDK_ROOT
echo "\$ANDROID_HOME=$ANDROID_HOME"
fi
if [ ! -z ${JAVA_HOME_BAK+x} ]; then export JAVA_HOME=$JAVA_HOME_BAK; unset JAVA_HOME_BAK; fi
if [ ! -z ${jdk+x} ]; then
if (( $(echo "$jdk > 9" | bc -l) )); then
export JAVA_HOME_bk=$JAVA_HOME
export JAVA_HOME=/snap/android-studio/current/android-studio/jre;
elif [ ! -z ${JAVA_HOME_bk+x} ]; then
export JAVA_HOME=$JAVA_HOME_bk
export JAVA_HOME_BAK=$JAVA_HOME
export JAVA_HOME="/snap/android-studio/current/android-studio/jre"
fi
echo "\$JAVA_HOME=$JAVA_HOME"
fi
if [ ! -z ${nodejs+x} ]; then nvm use $nodejs; fi
if [ ! -z ${gradle+x} ]; then sdk use gradle $gradle | tr -d '\n'; echo ; fi
if [ ! -z ${php+x} ]; then
local php_local=$(php --version | head -n 1 | §awk 2)
local php_local=$(php --version | awk '/^PHP/ {print $2}')
if [[ "$php_local" == "$php"* ]]; then
echo "php $php"
echo "PHP version: $php"
else
echo "php $php$php_local"
sudo update-alternatives --set php /usr/bin/php$php
echo "Switching PHP version: $php$php_local"
sudo update-alternatives --set php "/usr/bin/php$php"
sudo -k
fi
fi
unset android_home
unset nodejs
unset gradle
unset php
unset java
# Cleanup variables
unset android_home nodejs gradle php java
}

View File

@ -1,5 +1,5 @@
#
# This library is free software; you can redistribute it and/or
# This library is free software; you can baseRedistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
@ -27,21 +27,20 @@ base1=#282828
base2=#3f3f3f
base3=#808080
base4=#303030
vsblue=#AA89C0
aqua=#6FB2EA
bluegrey=#747e9e
orange=#CE9563
lime=#65ff00
grey=#94B386
red=#f00
redbg=#751212
green=#859900
blue=#268bd2
yellow=#dcdcaa
baseKeyword=#C89FE3
baseString=#6FB2EA
baseKeyWord2=#747e9e
baseNumber=#F19B78
baseComment=#94B386
baseRed=#f00
baseRedbg=#751212
baseGreen=#859900
baseKeyword3=#DCB55F
baseFunction=#dcdcaa
[named_styles]
default=base0;base1;true;false
error=red
error=baseRed
# Editor styles
@ -49,76 +48,76 @@ error=red
selection=;#000000;;true
current_line=;#212121;true
brace_good=base0;base2;true
brace_bad=red;;true
brace_bad=baseRed;;true
margin_line_number=base3;base4
margin_folding=base3;#212121
fold_symbol_highlight=base2
indent_guide=base2;;true
caret=aqua;;false
caret=baseString;;false
marker_line=#fff;#00f;
marker_search=#fff;#d791a8;
marker_mark=;
call_tips=base0;base1
white_space=base2;;true
white_space=base3;;true
# Programming languages
#-------------------------------------------------------------------------------
comment=grey
comment=baseComment
comment_doc=comment
comment_line=comment
comment_line_doc=comment_doc
comment_doc_keyword=comment_doc,bold
comment_doc_keyword_error=comment_doc,italic
number=orange
number=baseNumber
number_1=number
number_2=number_1
type=vsblue;;true
class=aqua
function=yellow
type=baseKeyword;;true
class=baseString
function=baseFunction
parameter=function
keyword=vsblue;;true
keyword=baseKeyword;;true
keyword_1=keyword
keyword_2=blue;;true
keyword_3=bluegrey
keyword_2=baseKeyword3;;true
keyword_3=baseKeyWord2
keyword_4=keyword_3
identifier=default
identifier_1=identifier
identifier_2=identifier_1
identifier_3=identifier_1
identifier_4=identifier_1
identifier_2=baseNumber
identifier_3=identifier_2
identifier_4=identifier_3
string=aqua
string=baseString
string_1=string
string_2=string_1
string_3=default
string_4=default
string_eol=red
string_eol=baseRed
character=string_1
backticks=string_2
here_doc=string_2
scalar=string_2
label=keyword,bold
preprocessor=aqua
preprocessor=baseString
regex=number_1
operator=base0
decorator=string_1,bold
other=aqua
other=baseString
# Markup-type languages
#-------------------------------------------------------------------------------
tag=vsblue
tag=baseKeyword
tag_unknown=tag,bold
tag_end=tag,bold
attribute=aqua
attribute=baseString
attribute_unknown=attribute,bold
value=string_1
entity=default
@ -127,6 +126,6 @@ entity=default
# Diff
#-------------------------------------------------------------------------------
line_added=green
line_removed=red
line_changed=blue
line_added=baseGreen
line_removed=baseRed
line_changed=baseKeyword3

View File

@ -24,7 +24,7 @@ lexer.cpp.track.preprocessor=1
lexer.cpp.update.preprocessor=1
[settings=CSS]
extension=less
extension=styl
lexer_filetype=python
tag_parser=CSS

View File

@ -76,7 +76,7 @@ Stylus=*.styl;
#Swift=*.swift;
#Tcl=*.tcl;*.tk;*.wish;*.exp;
#Txt2tags=*.t2t;
TypeScript=*.ts;*.tsx;*.d.ts;
TypeScript=*.ts;*.tsx;
SCSS=*.scss
SVG=*.svg
#Vala=*.vala;*.vapi;

View File

@ -134,12 +134,12 @@ msgwin_messages_visible=true
msgwin_scribble_visible=true
warn_on_project_close=true
documents_show_paths=true
sidebar_page=4
sidebar_page=3
pref_main_project_session=true
use_native_windows_dialogs=false
treeview_position=245
msgwindow_position=699
geometry=0;26;1920;1054;1;
treeview_position=226
msgwindow_position=755
geometry=1280;26;1277;1026;0;
use_native_dialogs=true
[tools]
@ -204,17 +204,17 @@ find_close_dialog=true
replace_regexp=false
replace_regexp_multiline=false
replace_case_sensitive=false
replace_escape_sequences=false
replace_escape_sequences=true
replace_match_whole_word=false
replace_match_word_start=false
replace_search_backwards=false
replace_close_dialog=true
find_all_expanded=false
replace_all_expanded=false
position_find_x=1257
position_find_y=459
position_replace_x=-1
position_replace_y=-1
replace_all_expanded=true
position_find_x=2201
position_find_y=372
position_replace_x=504
position_replace_y=397
position_fif_x=-1
position_fif_y=-1
@ -228,6 +228,7 @@ session_file=
project_file_path=/home/jaandrle/Dokumenty/Projekty/geany
[files]
recent_files=/home/jaandrle/Vzdálené/GitHub/Facilitator-App-Native/app/(app)/dashboard.tsx;/home/jaandrle/Vzdálené/GitHub/Facilitator-App-Native/components/SessionList/index.ts;/home/jaandrle/bin/asana.mjs;/home/jaandrle/Stažené/goto_matching_brace-function.txt;/home/jaandrle/.config/geany/filedefs/filetypes.SCSS.conf;/home/jaandrle/.config/geany/filedefs/filetypes.Less.conf;/home/jaandrle/.config/geany/filedefs/filetypes.Vue.conf;/home/jaandrle/Vzdálené/GitHub/deka-dom-el/index.js;/home/jaandrle/Vzdálené/GitHub/Facilitator-App-Native/app.config.ts;/home/jaandrle/Vzdálené/GitHub/deka-dom-el/src/dom.js;
recent_files=/home/jaandrle/Stažené/config.xml;/home/jaandrle/Stažené/sentry.php.json;/home/jaandrle/Vzdálené/GitHub/DHLC-Internet-Networking-old/web/api/index.php;/media/jaandrle/WARTY WARTH/geany/filetype_extensions.conf;/media/jaandrle/WARTY WARTH/geany/plugins/geanydoc/geanydoc.conf;/media/jaandrle/WARTY WARTH/geany/plugins/saveactions/saveactions.conf;/media/jaandrle/WARTY WARTH/geany/plugins/vimode/vimode.conf;/media/jaandrle/WARTY WARTH/geany/plugins/filebrowser/filebrowser.conf;/media/jaandrle/WARTY WARTH/geany/plugins/VC/VC.conf;/media/jaandrle/WARTY WARTH/geany/plugins/spellcheck/spellcheck.conf;
recent_projects=/home/jaandrle/Dokumenty/Projekty/geany/Facilitator-App-Native.geany;/home/jaandrle/Dokumenty/Projekty/geany/deka-dom-el.geany;/home/jaandrle/Dokumenty/Projekty/geany/Facilitator-App-Native;/home/jaandrle/Dokumenty/Projekty/geany/deka-dom-el;/home/jaandrle/Dokumenty/Projekty/geany/deka-dom-el/deka-dom-el;/home/jaandrle/Dokumenty/Projekty/geany/.babelrc;
current_page=-1
current_page=0
FILE_NAME_0=0;XML;0;EUTF-8;1;1;0;%2Fhome%2Fjaandrle%2FStažené%2Fconfig.xml;0;4

View File

@ -14,9 +14,9 @@ menu_reloadall=
file_openlasttab=
menu_quit=<Primary>q
menu_undo=<Primary>z
menu_redo=<Primary>y
edit_duplicateline=<Primary>d
edit_deleteline=<Primary>k
menu_redo=<Primary><Shift>z
edit_duplicateline=
edit_deleteline=
edit_deletelinetoend=<Primary><Shift>Delete
edit_deletelinetobegin=<Primary><Shift>BackSpace
edit_transposeline=
@ -24,7 +24,7 @@ edit_scrolltoline=<Primary><Shift>l
edit_scrolllineup=<Alt>Up
edit_scrolllinedown=<Alt>Down
edit_completesnippet=Tab
move_snippetnextcursor=
move_snippetnextcursor=<Shift>ISO_Left_Tab
edit_suppresssnippetcompletion=
popup_contextaction=
edit_autocomplete=<Primary>space
@ -64,7 +64,7 @@ edit_sendtocmd9=
edit_sendtovte=
format_reflowparagraph=<Primary>j
edit_joinlines=
menu_insert_date=<Shift><Alt>d
menu_insert_date=
edit_insertwhitespace=
edit_insertlinebefore=
edit_insertlineafter=
@ -140,7 +140,7 @@ switch_compiler=
switch_messages=
switch_scribble=F6
switch_vte=F4
switch_sidebar=
switch_sidebar=<Shift>F2
switch_sidebar_symbol_list=
switch_sidebar_doc_list=
switch_tableft=<Primary>Page_Up
@ -171,8 +171,8 @@ switch_head_impl=<Shift><Alt>s
goto_file=<Shift><Alt>g
[commander]
show_panel=<Primary>semicolon
show_panel_commands=
show_panel=
show_panel_commands=<Primary>semicolon
show_panel_files=
[file_browser]

View File

@ -8,9 +8,9 @@
"file_name": "github-desktop",
"exec": "yes",
"description": "Fork of GitHub Desktop to support various Linux distributions",
"last_update": "2024-07-01T20:15:47Z",
"last_update": "2024-08-10T17:00:04Z",
"downloads": "/home/jaandrle/bin/github-desktop",
"version": "release-3.4.2-linux1",
"version": "release-3.4.3-linux1",
"glare": ".*x86_64.*.AppImage"
},
{
@ -21,8 +21,8 @@
"exec": "yes",
"description": "AI Browser",
"glare": "AppImage",
"last_update": "2024-07-17T20:36:36Z",
"version": "2.0.4",
"last_update": "2024-07-29T15:29:11Z",
"version": "2.1.17",
"downloads": "/home/jaandrle/bin/pinokio"
},
{
@ -44,9 +44,9 @@
"group": "nondev",
"file_name": "youtube-music",
"exec": "yes",
"last_update": "2024-07-14T15:26:52Z",
"last_update": "2024-08-01T11:48:59Z",
"downloads": "/home/jaandrle/bin/youtube-music",
"version": "v3.4.1",
"version": "v3.5.1",
"glare": "AppImage"
},
{
@ -176,9 +176,9 @@
"group": "nondev",
"file_name": "fedistar",
"exec": "yes",
"last_update": "2024-07-21T09:19:41Z",
"last_update": "2024-08-08T13:46:23Z",
"downloads": "/home/jaandrle/bin/fedistar",
"version": "v1.9.9",
"version": "v1.9.10",
"glare": ".*amd64.*.AppImage"
},
{
@ -188,9 +188,9 @@
"group": "ai",
"file_name": "ollama",
"exec": "yes",
"last_update": "2024-07-21T18:21:56Z",
"last_update": "2024-08-13T20:27:42Z",
"downloads": "/home/jaandrle/bin/ollama",
"version": "v0.2.8-rc1",
"version": "v0.3.6",
"glare": "linux-amd64"
},
{
@ -212,9 +212,9 @@
"group": "dev",
"file_name": "escrcpy",
"exec": "yes",
"last_update": "2024-07-14T08:47:24Z",
"last_update": "2024-08-03T17:09:45Z",
"downloads": "/home/jaandrle/bin/escrcpy",
"version": "v1.21.4",
"version": "v1.22.4",
"glare": ".*x86_64.*.AppImage"
},
{

View File

@ -21,4 +21,11 @@
"command": "git",
"args": { "argv": [ "browse" ] }
},
{
"caption": "Branch -D --all (delete remote and local branch)",
"command": "delete_branch",
"args": {
"argv": [ true, true, true ]
}
}
]

View File

@ -8,4 +8,5 @@
"side_bar_layout": "tabs",
"signature_error_highlighting": "no_public_key",
"theme": "Merge Dark.sublime-theme",
"expand_merge_commits_by_default": true,
}

52
.ctags
View File

@ -1,5 +1,51 @@
--exclude=node_modules
--exclude=gulp
--exclude="*/node_modules/*"
--exclude=*.min.js
--exclude=*.min.css
--exclude=*.map
--exclude=.backup
--exclude=.sass-cache
--exclude=vendors
--exclude=.git
--langdef=css
--langmap=css:.css
--langmap=css:+.styl
--langmap=css:+.less
--regex-css=/^[ \t]*\.([A-Za-z0-9_-]+)/\1/c,class,classes/
--regex-css=/^[ \t]*#([A-Za-z0-9_-]+)/\1/i,id,ids/
--regex-css=/^[ \t]*(([A-Za-z0-9_-]+[ \t\n,]+)+)\{/\1/t,tag,tags/
--regex-css=/^[ \t]*@media\s+([A-Za-z0-9_-]+)/\1/m,media,medias/
--langdef=scss
--langmap=scss:.sass
--langmap=scss:+.scss
--regex-scss=/^[ \t]*@mixin ([A-Za-z0-9_-]+)/\1/m,mixin,mixins/
--regex-scss=/^[ \t]*@function ([A-Za-z0-9_-]+)/\1/f,function,functions/
--regex-scss=/^[ \t]*\$([A-Za-z0-9_-]+)/\1/v,variable,variables/
--regex-scss=/^([A-Za-z0-9_-]*)*\.([A-Za-z0-9_-]+) *[,{]/\2/c,class,classes/
--regex-scss=/^[ \t]+\.([A-Za-z0-9_-]+) *[,{]/\1/c,class,classes/
--regex-scss=/^(.*)*\#([A-Za-z0-9_-]+) *[,{]/\2/i,id,ids/
--regex-scss=/^[ \t]*#([A-Za-z0-9_-]+)/\1/i,id,ids/
--regex-scss=/(^([A-Za-z0-9_-])*([A-Za-z0-9_-]+)) *[,|\{]/\1/t,tag,tags/
--regex-scss=/(^([^\/\/])*)[ \t]+([A-Za-z0-9_-]+)) *[,|\{]/\3/t,tag,tags/
--regex-scss=/(^(.*, *)([A-Za-z0-9_-]+)) *[,|\{]/\3/t,tag,tags/
--regex-scss=/(^[ \t]+([A-Za-z0-9_-]+)) *[,|\{]/\1/t,tag,tags/
--regex-scss=/^[ \t]*@media\s+([A-Za-z0-9_-]+)/\1/d,media,media/
--langdef=stylus
--langmap=stylus:.styl
--regex-stylus=/^[ \t]*\.([A-Za-z0-9_-]+)/\1/c,class,classes/
--regex-stylus=/^[ \t]*#([A-Za-z0-9_-]+)/\1/i,id,ids/
--regex-stylus=/^[ \t]*(([A-Za-z0-9_-]+[ \t\n,]+)+)\{/\1/t,tag,tags/
--regex-stylus=/^[ \t]*@media\s+([A-Za-z0-9_-]+)/\1/m,media,medias/
--langdef=markdown
--langmap=markdown:.md
--regex-markdown=/^# (<.*>)?(.+)/\2/i,h1/
--regex-markdown=/^## (<.*>)?(.+)/\2/i,h2/
--regex-markdown=/^### (<.*>)?(.+)/\2/i,h3/
--langdef=js
--langmap=javascript:.js.es6.es.jsx.mjs
--javascript-kinds=-c-f-m-p-v
@ -157,4 +203,4 @@
--regex-typescript=/^[ \t]*(export[ \t]+)?interface[ \t]+([a-zA-Z0-9_$]+)/\2/i,interfaces/
--regex-typescript=/^[ \t]*(export[ \t]+)?type[ \t]+([a-zA-Z0-9_$]+)/\2/t,types/
--regex-typescript=/^[ \t]*(export[ \t]+)?enum[ \t]+([a-zA-Z0-9_$]+)/\2/e,enums/
--regex-typescript=/^[ \t]*import[ \t]+([a-zA-Z0-9_$]+)/\1/I,imports/
--regex-typescript=/^[ \t]*import[ \t]+([a-zA-Z0-9_$]+)/\1/I,imports/

View File

@ -37,7 +37,11 @@ const path_config= $.xdg.config`github-releases`;
const path_config_json= join(path_config, "config.json");
const path_config_lock= join(path_config, "lock");
const path_temp= $.xdg.temp`github-releases.json`;
const url_api= "https://api.github.com/repos/"; // "https://ungh.cc/repos/";
let url_api= "github";
const urls_api= {
github: "https://api.github.com/repos/",
ungh: "https://ungh.cc/repos/"
};
const url_download= "https://glare.now.sh/"; // https://github.com/Contextualist/glare
const css= echo.css`
.pkg { color: lightcyan; }
@ -48,9 +52,19 @@ const css= echo.css`
`;
$.api()
.version("2.0.0")
.version("2.1.0")
.describe("Helper for working with “packages” stored in GitHub releases.")
.command("config [mode]", [ "Config (file), use `mode` with these options:",
.option("--verbose", "Verbose output (WIP)")
.option("--group, -G", "Filter by group (not awaiable for noGRA)")
.option("--repository, -R", "Filter by repository (not awaiable for noGRA)")
.option("--api", [ "Choose API URL",
"- GitHub (default): https://api.github.com/repos/",
"- Ungh: https://ungh.cc/repos/", "(not awaiable for noGRA)" ], "github")
.command("unlock", "[noGRA] DANGER: Removes lock file. Use only if you know what you are doing!")
.action(function(){
s.rm(path_config_lock);
})
.command("config [mode]", [ "[noGR] Config (file), use `mode` with these options:",
"- `edit`: opens config file in terminal editor using `$EDITOR` (defaults to vim)",
"- `path`: prints path to config file"
])
@ -71,8 +85,6 @@ $.api()
"These are registered by this script but not managed by it (updates, etc).",
"Repositories marked with `+` signify that updates of the package are checked."
])
.option("--group, -G", "Filter by group")
.option("--repository, -R", "Filter by repository")
.action(function(filter){
const config = readConfig();
for(const { repository, version, description, group } of grepPackages(config, filter))
@ -83,8 +95,6 @@ $.api()
$.exit(0);
})
.command("check", "Shows/checks updates for registered packages")
.option("--group, -G", "Filter by group")
.option("--repository, -R", "Filter by repository")
.option("--cache", "Use cache [yes, no]", "yes")
.action(async function({ cache, ...filter }){
const config = readConfig();
@ -95,8 +105,6 @@ $.api()
$.exit(0);
})
.command("update", "Updates registered packages")
.option("--group, -G", "Filter by group")
.option("--repository, -R", "Filter by repository")
.action(async function(filter){
if(s.test("-f", path_config_lock))
return $.error(`The lock file '${path_config_lock}' already exists! Check if some other instance is running.`);
@ -127,7 +135,7 @@ $.api()
echo("Updating packages completed:");
for (const { status, value, reason } of updates) {
if(status==="rejected"){
echo("%c✗ "+reason.local.repository+": %c"+reason.err, css.err);
echo("%c✗ TBD reason.local.repository: %c"+reason.err, css.err);
continue;
}
const { local, remote }= value;
@ -162,11 +170,17 @@ async function download(value, onprogress, target){
return value;
}
function grepPackages({ packages }, { group, repository }){
function grepPackages({ packages }, { group, repository, api, verbose }){
if(api && api!==url_api && urls_api.hasOwnProperty(api))
url_api= api;
if(verbose)
echo(`Using API: ${url_api} (${urls_api[url_api]})`);
const f= {};
let is_filter= false;
if(group){ is_filter= true; f.group= group; }
if(repository){ is_filter= true; f.repository= repository; }
if(verbose)
echo("Filter:", f);
if(!is_filter) return packages;
return packages.filter(r=> Object.keys(f).every(k=> r[k]===f[k]));
}
@ -211,7 +225,7 @@ function packageStatus({ last_update: local }, { published_at: remote }){
async function fetchRelease({ repository, tag_name_regex }, cache){
const headers= { 'User-Agent': 'node' };
if(cache==="no") headers['Cache-Control'] = 'no-cache';
const url= url_api+repository+"/releases";
const url= urls_api[url_api]+repository+"/releases";
const releases= await fetch(url, { headers }).then(res=> res.json());
if(releases.message) return $.error(url+": "+releases.message);