mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-09-07 11:52:20 +08:00
fix: Can't launch some apps with space in Exec
Signed-off-by: shenmo <jifengshenmo@outlook.com>
This commit is contained in:
parent
beaa19e9e5
commit
97755980bc
@ -1,8 +1,42 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
log.warn() { echo -e "[\e[33mWARN\e[0m]: \e[1m$*\e[0m"; }
|
# ===== Log =====
|
||||||
log.error() { echo -e "[\e[31mERROR\e[0m]: \e[1m$*\e[0m"; }
|
# log.info xxx
|
||||||
log.info() { echo -e "[\e[96mINFO\e[0m]: \e[1m$*\e[0m"; }
|
# log.warn xxx
|
||||||
log.debug() { echo -e "[\e[32mDEBUG\e[0m]: \e[1m$*\e[0m"; }
|
# log.info xxx
|
||||||
|
# log.debug xxx
|
||||||
|
# 带颜色的echo
|
||||||
|
function log.color_output() {
|
||||||
|
local color=$1
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
echo >&2 -e "\033[${color}m$@\033[0m"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Log is named without prefix "utils." for convenience
|
||||||
|
# Usage: log.log <level> ...content
|
||||||
|
function log.log() {
|
||||||
|
if [[ $# < 2 ]]; then
|
||||||
|
return -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local level=$1
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
case $level in
|
||||||
|
error) log.color_output "0;31" "[ERROR] $@" ;;
|
||||||
|
warn) log.color_output "1;33" "[WARN] $@" ;;
|
||||||
|
info) log.color_output "1;37" "[INFO] $@" ;;
|
||||||
|
debug) log.color_output "1;30" "[DEBUG] $@" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function log.error() { log.log "error" "$@"; }
|
||||||
|
function log.warn() { log.log "warn" $@; }
|
||||||
|
function log.info() { log.log "info" $@; }
|
||||||
|
function log.debug() { log.log "debug" $@; }
|
||||||
|
|
||||||
|
|
||||||
function scan_desktop_file_log(){
|
function scan_desktop_file_log(){
|
||||||
@ -67,7 +101,7 @@ function launch_app(){
|
|||||||
log.info "Command is $exec_command"
|
log.info "Command is $exec_command"
|
||||||
|
|
||||||
# 在默认终端执行命令
|
# 在默认终端执行命令
|
||||||
eval "$exec_command"
|
bash -c $exec_command
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$#" -lt 2 ];then
|
if [ "$#" -lt 2 ];then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user