mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-19 15:04:50 +02:00
more work on porting command parsing to Go
This commit is contained in:
@@ -9,7 +9,6 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func parse_scroll_amount(amt string) ([2]interface{}, error) {
|
||||
var ans [2]interface{}
|
||||
func parse_scroll_amount(amt string) ([]interface{}, error) {
|
||||
var ans = make([]interface{}, 2)
|
||||
if amt == "start" || amt == "end" {
|
||||
ans[0] = amt
|
||||
ans[1] = nil
|
||||
|
||||
19
tools/cmd/at/set_background_opacity.go
Normal file
19
tools/cmd/at/set_background_opacity.go
Normal file
@@ -0,0 +1,19 @@
|
||||
// License: GPLv3 Copyright: 2022, Kovid Goyal, <kovid at kovidgoyal.net>
|
||||
|
||||
package at
|
||||
|
||||
import "strconv"
|
||||
|
||||
func parse_opacity(arg string) (float64, error) {
|
||||
ans, err := strconv.ParseFloat(arg, 64)
|
||||
if err != nil {
|
||||
return 0, nil
|
||||
}
|
||||
if ans < 0.1 {
|
||||
ans = 0.1
|
||||
}
|
||||
if ans > 1 {
|
||||
ans = 1
|
||||
}
|
||||
return ans, nil
|
||||
}
|
||||
Reference in New Issue
Block a user