fix: 修改 fetchself 解析器中的命令执行逻辑,简化命令构建方式以提高代码可读性
This commit is contained in:
parent
84b6d0a9e3
commit
27d5291f2b
@ -147,8 +147,7 @@ type Parser interface {
|
|||||||
type fastdfetchParser struct{}
|
type fastdfetchParser struct{}
|
||||||
|
|
||||||
func (p *fastdfetchParser) Parse(cmd string) (SystemInfo, error) {
|
func (p *fastdfetchParser) Parse(cmd string) (SystemInfo, error) {
|
||||||
fullCmd := fmt.Sprintf("%s --color_blocks off", cmd)
|
output, err := exec.Command(cmd).Output()
|
||||||
output, err := exec.Command(fullCmd).Output()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return SystemInfo{}, err
|
return SystemInfo{}, err
|
||||||
}
|
}
|
||||||
@ -223,8 +222,7 @@ func (p *fastdfetchParser) Parse(cmd string) (SystemInfo, error) {
|
|||||||
type neofetchParser struct{}
|
type neofetchParser struct{}
|
||||||
|
|
||||||
func (p *neofetchParser) Parse(cmd string) (SystemInfo, error) {
|
func (p *neofetchParser) Parse(cmd string) (SystemInfo, error) {
|
||||||
fullCmd := fmt.Sprintf("%s --color_blocks off", cmd)
|
output, err := exec.Command(cmd, "--color_blocks", "off").Output()
|
||||||
output, err := exec.Command(fullCmd).Output()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return SystemInfo{}, err
|
return SystemInfo{}, err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user