mirror of
https://github.com/liclac/ambient
synced 2024-11-24 20:53:04 +00:00
Don't fail horribly when not on an ICE
This commit is contained in:
parent
7ae86f8313
commit
91dbae46af
4 changed files with 11 additions and 13 deletions
12
ambient
12
ambient
|
@ -4,18 +4,8 @@
|
|||
set -l ambient_path (dirname (status --current-filename))
|
||||
cd $ambient_path
|
||||
|
||||
# Make fish autoload our functions before trying built-in ones.
|
||||
set -p fish_function_path $ambient_path/functions.d
|
||||
|
||||
# Accumulate non-empty KEY=VALUE pairs output from subscripts.
|
||||
set -l environment
|
||||
for file in ./ambient.d/**/*.fish
|
||||
for line in (source $file)
|
||||
if [ -n "$line" ]
|
||||
set -a environment "$line"
|
||||
end
|
||||
end
|
||||
end
|
||||
set -l environment (./lib/_dispatch_ambient.fish)
|
||||
|
||||
# If arguments are given, call it as a command, with ambient data in the environment.
|
||||
if [ (count $argv) -gt 0 ]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
ambient_is_ssid "WIFIonICE" or exit
|
||||
ambient_is_ssid "WIFIonICE"; or exit
|
||||
|
||||
curl -s https://iceportal.de/api1/rs/status | jq -r '"
|
||||
AMBIENT_DE_ICE_CONNECTION=\(.connection)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function ambient_is_ssid
|
||||
set -l ssid ambient_get_ssid
|
||||
set -l ssid (ambient_get_ssid)
|
||||
for arg in $argv
|
||||
if [ "$arg" = "$ssid" ]
|
||||
return 0
|
||||
|
|
8
lib/_dispatch_ambient.fish
Executable file
8
lib/_dispatch_ambient.fish
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env fish
|
||||
|
||||
# Make fish autoload our functions before trying built-in ones.
|
||||
set -p fish_function_path ./functions.d
|
||||
|
||||
for file in ./ambient.d/**/*.fish
|
||||
source $file
|
||||
end
|
Loading…
Reference in a new issue