Commit dea8d79
luci-base: add uci.get_bool to allow cleanup of app code
Any number of apps read boolean values from configuration files, then use
various inconsistent means for checking truth values. The get_bool function
allows app authors to fetch the value without regard for how it is represented
in the config file.
For example, this
let enabled = uci.get('system', 'ntp', 'enable_server');
if (enabled == '1') ...
could become the more natural
let enabled = uci.get_bool('system', 'ntp', 'enable_server');
if (enabled) ...
Signed-off-by: Eric Fahlgren <ericfahlgren@gmail.com>1 parent 8b00d02 commit dea8d79
1 file changed
+34
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
704 | 704 | | |
705 | 705 | | |
706 | 706 | | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
707 | 741 | | |
708 | 742 | | |
709 | 743 | | |
| |||
0 commit comments