corr config dir
This commit is contained in:
parent
0ed91fb615
commit
898380a806
BIN
scut-latest.zip
BIN
scut-latest.zip
Binary file not shown.
@ -1 +1 @@
|
|||||||
50d52bf221895543be50fc003999c118285682fabcfb4976c771b44606b347ac scut-latest.zip
|
130163078c145aa0ca4ca54f0ad6b8bf578d5fcd7766694048cd0169c6fa80ac scut-latest.zip
|
||||||
|
27
scut.go
27
scut.go
@ -21,9 +21,31 @@ type Config struct {
|
|||||||
Apps []App `json:"apps"`
|
Apps []App `json:"apps"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getHomeDir() string {
|
||||||
|
|
||||||
|
// get home directory
|
||||||
|
home, err := os.UserHomeDir()
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return home
|
||||||
|
}
|
||||||
|
|
||||||
|
func getConfigScutDir() string {
|
||||||
|
// get home directory
|
||||||
|
home := getHomeDir()
|
||||||
|
|
||||||
|
// get config directory
|
||||||
|
configDir := home + "/.config/scut/config/"
|
||||||
|
|
||||||
|
return configDir
|
||||||
|
}
|
||||||
|
|
||||||
func loadConfig(dir string) Config {
|
func loadConfig(dir string) Config {
|
||||||
apps := []App{}
|
apps := []App{}
|
||||||
|
|
||||||
|
fmt.Println(dir)
|
||||||
|
|
||||||
// Ouvre le répertoire config
|
// Ouvre le répertoire config
|
||||||
files, err := ioutil.ReadDir(dir)
|
files, err := ioutil.ReadDir(dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -72,13 +94,16 @@ func main() {
|
|||||||
fmt.Println("")
|
fmt.Println("")
|
||||||
}
|
}
|
||||||
|
|
||||||
configDir := flag.String("c", "~/.config/scut/config/", "Config directory")
|
configDir := flag.String("c", getConfigScutDir(), "Config directory")
|
||||||
|
|
||||||
appName := flag.String("a", "", "Application name")
|
appName := flag.String("a", "", "Application name")
|
||||||
|
|
||||||
filter := flag.String("f", "", "Filter")
|
filter := flag.String("f", "", "Filter")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
// print config directory
|
||||||
|
fmt.Println(*configDir)
|
||||||
|
|
||||||
config := loadConfig(*configDir)
|
config := loadConfig(*configDir)
|
||||||
|
|
||||||
cleanFilter := strings.TrimFunc(*filter, func(r rune) bool {
|
cleanFilter := strings.TrimFunc(*filter, func(r rune) bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user