|
13 | 13 | # see: https://askubuntu.com/questions/984205/how-to-save-gnome-settings-in-a-file |
14 | 14 |
|
15 | 15 |
|
16 | | -# TODO - use sth like this: |
17 | | -# apply_gsettings() { |
18 | | - # local schema="$1" |
19 | | - # while IFS= read -r line; do |
20 | | - # [[ -z "$line" || "$line" =~ ^# ]] && continue |
21 | | - # gsettings set "$schema" "$line" |
22 | | - # done |
23 | | - # } |
24 | | - # |
25 | | - # apply_gsettings "test" <<EOF |
26 | | - # ano |
27 | | - # nie #blabla |
28 | | - # mozno |
29 | | - # |
30 | | - # # lala |
31 | | - # sjsjdj |
32 | | - # |
33 | | - # EOF |
34 | | - |
35 | | -# resp |
36 | | -# mapfile -t my_list <<'EOF' |
37 | | -# simpleitem |
38 | | -# item with spaces |
39 | | -# item with a 'single quote' |
40 | | -# item with a "double quote" |
41 | | -# item with both 'single' and "double" quotes |
42 | | -# EOF |
43 | | - |
44 | | -# Print each item |
45 | | -# for item in "${my_list[@]}"; do |
46 | | -# echo "$item" |
47 | | -# done |
48 | | - |
49 | | -# resp |
50 | | -# xargs -d '\n' -I{} echo "Processing: {}" <<'EOF' |
| 16 | +# TODO - simplify repeated prefixes as follows: |
| 17 | + |
| 18 | +# run_with_prefix() { |
| 19 | +# local cmd="$1" |
| 20 | +# if [[ -z "$cmd" ]]; then |
| 21 | +# echo TODO add explanation what the command does. |
| 22 | +# echo TODO add help/man page |
| 23 | +# echo "Missing command to prefix the lines." |
| 24 | +# echo "Usage: process_items <command>" |
| 25 | +# echo "Items are passed to stdin (usually as heredocument)" |
| 26 | +# return 1 |
| 27 | +# fi |
| 28 | +# grep -vE '^[[:space:]]*(#|$)' | xargs -r -d '\n' -I{} $1 "Processing: {}" |
| 29 | +# } |
| 30 | + |
| 31 | +# run_with_prefix 'echo' <<'EOF' |
| 32 | +# # This is a comment |
51 | 33 | # first item |
| 34 | + |
52 | 35 | # second item with spaces |
| 36 | +# # another comment |
53 | 37 | # third item with "quotes" and 'single quotes' |
| 38 | + |
54 | 39 | # EOF |
55 | 40 |
|
| 41 | +# Add the helper function to prelude? |
| 42 | +# TODO - try to use lists where possible... |
| 43 | + |
| 44 | + |
56 | 45 | # TODO pohrat sa s tymi nastaveniami, ci vlastne su vsetky potrebne a robia to co chcem |
57 | 46 |
|
58 | 47 | . ../prelude.sh |
|
0 commit comments