gosmartkeyboard/docs/Input.html

57 lines
1.5 KiB
HTML
Raw Normal View History

2023-03-07 22:29:26 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>GoSmartKeyboard</title>
<link rel="stylesheet" href="google-code-prettify/prettify.css">
<link rel="stylesheet" href="styles/prettify-theme.css">
<script defer src="google-code-prettify/prettify.js"></script>
<script defer src="google-code-prettify/run_prettify.js"></script>
<link rel="stylesheet" href="styles/main.css">
</head>
<!-- Generated by srcweave https://github.com/justinmeiners/srcweave -->
<h1>Simple Input<a id="c24"></a></h1>
<p>This tool reads lines from stdin and sends them to the server.</p>
<p>Newline characters are only sent when a blank line is entered.</p>
<div class="code-block">
<span class="block-header">
<strong class="block-title"><em><a id="-tools-input-input.go-block-86" href="#-tools-input-input.go-block-86">/tools/input/input.go</a></em></strong></span>
<pre class="prettyprint"><code class="">package main
import (
"io/ioutil"
"bufio"
"os"
)
func main(){
var input string
<em class="block-link nocode" title="undefined block">@{get client input file from environment}</em>
if ! clientFifoInputFileExists {
os.Exit(1)
}
for {
reader := bufio.NewReader(os.Stdin)
input, _ = reader.ReadString('\n')
if len(input) &gt; 0 {
ioutil.WriteFile(clientFifoInputFile, []byte(input), 0644)
} else {
ioutil.WriteFile(clientFifoInputFile, []byte("\n"), 0644)
}
input = ""
}
}
</code></pre>
</div>
</body>
</html>