mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-08-30 05:46:35 -04:00
Move "clipclear" argument functionality to offline function to better facilitate third-party implementations
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package offline
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
@@ -34,3 +35,14 @@ func writeToStdin(cmd *exec.Cmd, input string) {
|
||||
io.WriteString(stdin, input)
|
||||
}()
|
||||
}
|
||||
|
||||
func ClipClearArgument() {
|
||||
// read previous clipboard contents from stdin
|
||||
clipScanner := bufio.NewScanner(os.Stdin)
|
||||
if clipScanner.Scan() {
|
||||
oldContents := clipScanner.Text()
|
||||
ClipClear(oldContents)
|
||||
} else {
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user