maj json
This commit is contained in:
parent
c80099524e
commit
e74f1da2af
@ -6,8 +6,12 @@ Scut-Reminder est un petit utilitaire en ligne de commande pour gérer et lister
|
||||
|
||||
```
|
||||
scut // Affiche la liste des applications
|
||||
|
||||
scut -c MaConfig.json -a "nevim" // Affiche liste des raccourcis de nevim de MaConfig.json
|
||||
|
||||
scut -a "Visual Studio Code" // Affiche liste des raccourcis de vscode
|
||||
|
||||
scut -u // Afficher liste des urls d'aide au raccourcis
|
||||
```
|
||||
|
||||
## Options
|
||||
|
@ -1,24 +1,30 @@
|
||||
{
|
||||
"name": "GNOME",
|
||||
"url": "https://help.gnome.org/users/gnome-help/stable/shell-keyboard-shortcuts.html.en",
|
||||
"shortcuts": {
|
||||
"ctrl+alt+t": "Terminal",
|
||||
"ctrl+alt+d": "Show Desktop",
|
||||
"super+t": "* Terminal",
|
||||
"super+f": "* Files",
|
||||
"super+r": "* Run Command",
|
||||
"super": "Activities Overview",
|
||||
"super+a": "Applications",
|
||||
"super+f": "Files",
|
||||
"super+t": "Terminal",
|
||||
"super+d": "Show Desktop",
|
||||
"super+a": "Show Applications",
|
||||
"super+l": "Lock Screen",
|
||||
"super+shift+q": "Log Out",
|
||||
"super+shift+d": "Show Applications",
|
||||
"super+page up": "Switch Workspace on the right",
|
||||
"super+page down": "Switch Workspace on the left",
|
||||
"super+1-9": "Switch to Workspace 1-9",
|
||||
"ctrl+alt+arrow": "Switch Workspace",
|
||||
"ctrl+alt+up": "Maximize Window",
|
||||
"ctrl+alt+down": "Unmaximize Window",
|
||||
"alt+tab": "Switch Applications",
|
||||
"alt+`": "Switch Windows of the Same Application",
|
||||
"alt+f2": "Run Command",
|
||||
"super+1": "Open Email",
|
||||
"super+2": "Open Calendar",
|
||||
"super+3": "Open Contacts",
|
||||
"super+4": "Open Photos",
|
||||
"super+5": "Open Files Manager",
|
||||
"super+6": "Open Browser",
|
||||
"super+7": "Open Settings",
|
||||
"super+8": "Open Terminal",
|
||||
"super+9": "Open Dashboard",
|
||||
"super+up": "Maximize Window",
|
||||
"super+h": "Hide Window",
|
||||
"super+tab": "Switch Applications",
|
||||
"super+`": "Switch Windows of the Same Application",
|
||||
"ctrl+alt+delete": "Log Out/Power Off/Restart",
|
||||
"ctrl+c": "Copy",
|
||||
"ctrl+v": "Paste",
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"name": "Kitty Terminal",
|
||||
"url": "https://github.com/jmcastagnetto/kitty-terminal-cheatsheet/blob/fbdf2e6ed4c6ef07d01a9eca7d07fc1e889769ed/kitty-terminal-cheatsheet.pdf",
|
||||
"shortcuts": {
|
||||
"Ctrl+Shift+T": "New tab",
|
||||
"Ctrl+Shift+W": "Close tab",
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"name": "Neovim",
|
||||
"url": "https://cheatography.com/dcschmid/cheat-sheets/personal-neovim-cheatsheet/pdf/",
|
||||
"shortcuts": {
|
||||
"i": "Insert mode",
|
||||
"esc": "Normal mode",
|
||||
|
@ -1,13 +1,14 @@
|
||||
{
|
||||
"name": "Visual Studio Code",
|
||||
"name": "vscode",
|
||||
"url": "https://code.visualstudio.com/shortcuts/keyboard-shortcuts-linux.pdf",
|
||||
"shortcuts": {
|
||||
"Ctrl+Shift+P": "Command Palette",
|
||||
"Ctrl+k Ctrl+R": "Help Keyboard Shortcuts Reference",
|
||||
"Ctrl+Shift+N": "New Window",
|
||||
"Ctrl+Shift+W": "Close Window",
|
||||
"Ctrl+Shift+T": "Reopen Closed Editor",
|
||||
"Ctrl+Tab": "Switch Editor",
|
||||
"Ctrl+Shift+Tab": "Switch Editor in Reverse Order",
|
||||
"Ctrl+Shift+M": "Toggle Problems Panel",
|
||||
"Ctrl+Shift+G": "Toggle Source Control",
|
||||
"Ctrl+Shift+D": "Toggle Debug",
|
||||
"Ctrl+Shift+X": "Toggle Extensions",
|
||||
@ -22,7 +23,6 @@
|
||||
"Ctrl+Shift+O": "Go to Symbol",
|
||||
"Ctrl+Shift+M": "Show Problems",
|
||||
"Ctrl+Shift+J": "Toggle Search Details",
|
||||
"Ctrl+Shift+D": "Duplicate Line or Selection",
|
||||
"Alt+Up": "Move Line Up",
|
||||
"Alt+Down": "Move Line Down",
|
||||
"Ctrl+Shift+K": "Delete Line",
|
||||
|
BIN
scut-latest.zip
BIN
scut-latest.zip
Binary file not shown.
@ -1 +1 @@
|
||||
9e47bb0036eddd0391f5018caec3168c6324295daa31d7864c711d766f5bc0ca scut-latest.zip
|
||||
339eb7a4e1c68c6a23dcd0487f5df2cb368d091f3044d62608d7a704f040b22e scut-latest.zip
|
||||
|
53
scut.go
53
scut.go
@ -15,6 +15,7 @@ import (
|
||||
type App struct {
|
||||
Name string `json:"name"`
|
||||
Shortcuts map[string]string `json:"shortcuts"`
|
||||
HelpUrl string `json:"url"`
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
@ -32,11 +33,34 @@ func getHomeDir() string {
|
||||
}
|
||||
|
||||
func getConfigScutDir() string {
|
||||
|
||||
var configDir string
|
||||
|
||||
// get home directory
|
||||
home := getHomeDir()
|
||||
homePathDir := home + "/.config/scut/config/"
|
||||
|
||||
// get config directory
|
||||
configDir := home + "/.config/scut/config/"
|
||||
// get current directory of the binary
|
||||
ex, err := os.Executable()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
// get current directory of the binary without the binary name
|
||||
exePathDir := strings.TrimSuffix(ex, filepath.Base(ex))
|
||||
exePathDir = exePathDir + "config/"
|
||||
|
||||
//if exePathDir existe alors on utilise le répertoire config du binaire
|
||||
if _, err := os.Stat(exePathDir); err == nil {
|
||||
configDir = exePathDir
|
||||
|
||||
//si non si homePathDir existe alors on utilise le répertoire config du home
|
||||
} else if _, err := os.Stat(homePathDir); err == nil {
|
||||
|
||||
configDir = homePathDir
|
||||
//si non on utilise le répertoire config du binaire
|
||||
} else {
|
||||
configDir = ""
|
||||
}
|
||||
|
||||
return configDir
|
||||
}
|
||||
@ -56,6 +80,7 @@ func loadConfig(dir string) Config {
|
||||
for _, file := range files {
|
||||
if filepath.Ext(file.Name()) == ".json" {
|
||||
data, _ := ioutil.ReadFile(dir + "/" + file.Name())
|
||||
|
||||
var app App
|
||||
json.Unmarshal(data, &app)
|
||||
apps = append(apps, app)
|
||||
@ -64,6 +89,7 @@ func loadConfig(dir string) Config {
|
||||
config := Config{
|
||||
Apps: apps,
|
||||
}
|
||||
|
||||
return config
|
||||
}
|
||||
|
||||
@ -81,6 +107,7 @@ func main() {
|
||||
fmt.Printf(" -c PathDuDossierConfig || Path du dossier de configuration au lieu du répertoire ./config (par défaut)\n")
|
||||
fmt.Printf(" -a Nom Application || Afficher les raccourcis de l'application spécifiée\n")
|
||||
fmt.Printf(" -f fitre || Filtrer les raccourcis qui contiennent le filtre\n")
|
||||
fmt.Printf(" -u || Afficher les URLs des raccourcis de chaque applications\n")
|
||||
fmt.Printf(" -h || Afficher cette aide\n")
|
||||
fmt.Println("")
|
||||
fmt.Println(" Example :")
|
||||
@ -97,15 +124,34 @@ func main() {
|
||||
appName := flag.String("a", "", "Application name")
|
||||
|
||||
filter := flag.String("f", "", "Filter")
|
||||
|
||||
urls := flag.Bool("u", false, "Afficher les URLs d'aide des raccourcis de chaque applications")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
fmt.Println(*configDir)
|
||||
|
||||
config := loadConfig(*configDir)
|
||||
|
||||
cleanFilter := strings.TrimFunc(*filter, func(r rune) bool {
|
||||
return !unicode.IsGraphic(r)
|
||||
})
|
||||
|
||||
if *appName == "" {
|
||||
if *urls == true {
|
||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 10, '.', 0)
|
||||
fmt.Println(underline)
|
||||
fmt.Println(" U R L S")
|
||||
fmt.Println(underline)
|
||||
for _, app := range config.Apps {
|
||||
|
||||
// fmt.Printf("%s %s\n", app.Name, app.HelpUrl)
|
||||
fmt.Fprintf(w, "%s \t %s\n", app.Name, app.HelpUrl)
|
||||
|
||||
}
|
||||
w.Flush()
|
||||
|
||||
} else if *appName == "" {
|
||||
|
||||
// List all applications
|
||||
fmt.Println(underline)
|
||||
fmt.Println(" A P P L I C A T I O N S")
|
||||
@ -114,6 +160,7 @@ func main() {
|
||||
fmt.Printf("%s\n", app.Name)
|
||||
}
|
||||
fmt.Println()
|
||||
|
||||
} else {
|
||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 10, '.', 0)
|
||||
if *filter != "" {
|
||||
|
Loading…
Reference in New Issue
Block a user