Skip to content

Commit

Permalink
[feature] redirect logs into /dev/null, avoid creating temp file.
Browse files Browse the repository at this point in the history
[feature] optimize readme

Signed-off-by: shadowhao <shadowhao.tencent.com>
  • Loading branch information
shadowhao committed Jan 27, 2022
1 parent 03aa18a commit a9b9578
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 212 deletions.
Binary file removed .DS_Store
Binary file not shown.
8 changes: 0 additions & 8 deletions .idea/bluetooth_flow.iml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

178 changes: 0 additions & 178 deletions .idea/workspace.xml

This file was deleted.

9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Alfred 4 workflow for mac bluetooth.

## Installation
1. Download latest version from [releases](https://github.com/haoguanguan/bluetooth_flow/releases)
1. Download latest version from [release](https://github.com/haoguanguan/bluetooth_flow/releases)
2. Double click and install it
## Manual
1. show all device info: just input `bb`
Expand All @@ -12,16 +12,17 @@ Alfred 4 workflow for mac bluetooth.

## Features
1. show bluetooth device info

status/battery/name
2. switch bluetooth status
connect -> disconnect
disconnect -> connect
1. connect -> disconnect
2. disconnect -> connect

## Build
```shell script
go build entry.go
```
You should download golang, and use go mod for dependency manager.
You should download golang, and use go mod for dependency management.
## Acknowledgement
1. I Got much information from [alfred-bluetooth-workflow](https://github.com/tilmanginzel/alfred-bluetooth-workflow)
2. I also used [blueutil](https://github.com/toy/blueutil) for quickly switch device status
Expand Down
Binary file removed entry
Binary file not shown.
9 changes: 1 addition & 8 deletions system/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package system
import (
"encoding/json"
"fmt"
"os"
"os/exec"
)

Expand All @@ -13,18 +12,12 @@ type Info struct {
}

func NewSystem(key string) (*Info, error) {
command := fmt.Sprintf("system_profiler %s -json > .system.log", key)
command := fmt.Sprintf("system_profiler %s -json 2> /dev/null", key)
d, err := exec.Command("bash", "-c", command).CombinedOutput()
if err != nil {
return nil, err
}

// fmt.Printf("%s", string(d))
d, err = os.ReadFile(".system.log")
if err != nil {
return nil, err
}

var res map[string]interface{}
if err = json.Unmarshal(d, &res); err != nil {
return nil, err
Expand Down

0 comments on commit a9b9578

Please sign in to comment.