Add basic dimswitch
Prints out current version number and simple usage instructions on invocation with -h, --help, -v, --version. Displays used configuration file when invoked with -i/--info. Adds simple toggle ability script, used by simply invoking `dimswitch` from the .local/bin/ directory. In this dotfile configuration that directory is added to the path, so can be invoked from anywhere. Invoked without any options it will look for a line which specifies a theme with a `-light` or `-dark` option appended, and switch them out. Does not change the vim colorscheme or background, and can not change the theme in alacritty itself. The extent of this script is still limited, if it should be expanded python seems more suited. For further discussion, see its original Merge Request !18.
This commit is contained in:
parent
659bd61af3
commit
499d375791
4 changed files with 263 additions and 4 deletions
63
.local/bin/test/dimswitch.bats
Normal file
63
.local/bin/test/dimswitch.bats
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
setup() {
|
||||
fut="$BATS_TEST_DIRNAME/../dimswitch"
|
||||
}
|
||||
|
||||
@test "[-v flag] Displays version information" {
|
||||
run $fut -v
|
||||
[ "$status" -eq 0 ]
|
||||
match='^.* [0-9]\.[0-9]\.[0-9]$'
|
||||
echo $output
|
||||
if echo "$output" | grep "$match";then true;else false; fi
|
||||
}
|
||||
|
||||
@test "[--version flag] Displays version information" {
|
||||
run $fut --version
|
||||
[ "$status" -eq 0 ]
|
||||
match='^.* [0-9]\.[0-9]\.[0-9]$'
|
||||
echo $output
|
||||
if echo "$output" | grep "$match";then true;else false; fi
|
||||
}
|
||||
|
||||
@test "[-h flag] Displays usage information" {
|
||||
run $fut -h
|
||||
[ "$status" -eq 0 ]
|
||||
match='^.*Usage:.*$'
|
||||
echo $output
|
||||
if echo "$output" | grep "$match";then true;else false; fi
|
||||
}
|
||||
|
||||
@test "[--help flag] Displays usage information" {
|
||||
run $fut --help
|
||||
[ "$status" -eq 0 ]
|
||||
match='^.*Usage:.*$'
|
||||
echo $output
|
||||
if echo "$output" | grep "$match";then true;else false; fi
|
||||
}
|
||||
|
||||
#### _findfile
|
||||
|
||||
@test "[-i flag] Displays config file for alacritty" {
|
||||
export DIM_PROGRAMS="alacritty"
|
||||
export DIM_ALACRITTY_CONF="$BATS_TEST_DIRNAME/files/alacritty_conf.yml"
|
||||
|
||||
run $fut -i
|
||||
[ "$status" -eq 0 ]
|
||||
match="^alacritty - $DIM_ALACRITTY_CONF"
|
||||
|
||||
echo $output
|
||||
|
||||
if echo "$output" | grep "$match";then true;else false;fi
|
||||
}
|
||||
|
||||
@test "[-i flag] Displays error if no config file found" {
|
||||
export DIM_PROGRAMS="alacritty"
|
||||
export DIM_ALACRITTY_CONF="$BATS_TEST_DIRNAME/files/nonexisting_alacritty_conf.yml"
|
||||
|
||||
run $fut -i
|
||||
[ "$status" -eq 0 ]
|
||||
match="^alacritty - No associated configuration file found."
|
||||
|
||||
echo $output
|
||||
|
||||
if echo "$output" | grep "$match";then true;else false;fi
|
||||
}
|
||||
0
.local/bin/test/files/alacritty_conf.yml
Normal file
0
.local/bin/test/files/alacritty_conf.yml
Normal file
Loading…
Add table
Add a link
Reference in a new issue