From d5f8202c05070af5b76629912fbc019127263a77 Mon Sep 17 00:00:00 2001 From: ShuheiKubota Date: Sun, 10 Nov 2019 11:15:30 +0900 Subject: [PATCH] change: remove restore command, add --restore for each subcommand --- vvin.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/vvin.go b/vvin.go index b391dc5..22130fe 100644 --- a/vvin.go +++ b/vvin.go @@ -31,7 +31,6 @@ type globalCmd struct { Minimize minCmd `cli:"minimize,min"` Maximize maxCmd `cli:"maximize,max"` - Restore restoreCmd `cli:"restore"` Resize resizeCmd `cli:"resize,move,mv"` Alpha alphaCmd `cli:"alpha"` Topmost topmostCmd `cli:"topmost"` @@ -89,24 +88,27 @@ func (c *globalCmd) Before() error { } type minCmd struct { + Restore bool `cli:"restore,r"` } func (c minCmd) Run(g globalCmd) { - showWindow.Call(uintptr(g.targetHandle), SW_MINIMIZE) + if c.Restore { + showWindow.Call(uintptr(g.targetHandle), SW_RESTORE) + } else { + showWindow.Call(uintptr(g.targetHandle), SW_MINIMIZE) + } } type maxCmd struct { + Restore bool `cli:"restore,r"` } func (c maxCmd) Run(g globalCmd) { - showWindow.Call(uintptr(g.targetHandle), SW_MAXIMIZE) -} - -type restoreCmd struct { -} - -func (c restoreCmd) Run(g globalCmd) { - showWindow.Call(uintptr(g.targetHandle), SW_RESTORE) + if c.Restore { + showWindow.Call(uintptr(g.targetHandle), SW_RESTORE) + } else { + showWindow.Call(uintptr(g.targetHandle), SW_MAXIMIZE) + } } type resizeCmd struct {