File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -15,14 +15,16 @@ import (
1515)
1616
1717type client struct {
18- host string
19- port int
18+ host string
19+ port int
20+ lineEnding string
2021}
2122
2223func New (c * lemon.CLI ) * client {
2324 return & client {
24- host : c .Host ,
25- port : c .Port ,
25+ host : c .Host ,
26+ port : c .Port ,
27+ lineEnding : c .LineEnding ,
2628 }
2729}
2830
@@ -95,7 +97,7 @@ func (c *client) Paste() (string, error) {
9597 return "" , err
9698 }
9799
98- return resp , nil
100+ return lemon . ConvertLineEnding ( resp , c . lineEnding ) , nil
99101}
100102
101103func (c * client ) Copy (text string ) error {
Original file line number Diff line number Diff line change 11package server
22
3- import "github.com/atotto/clipboard"
3+ import (
4+ "github.com/atotto/clipboard"
5+ "github.com/pocke/lemonade/lemon"
6+ )
47
58type Clipboard struct {}
69
710func (_ * Clipboard ) Copy (text string , _ * struct {}) error {
811 <- connCh
9- return clipboard .WriteAll (text )
12+ return clipboard .WriteAll (lemon . ConvertLineEnding ( text , lineEndingOpt ) )
1013}
1114
1215func (_ * Clipboard ) Paste (_ struct {}, resp * string ) error {
Original file line number Diff line number Diff line change @@ -12,9 +12,12 @@ import (
1212
1313var connCh = make (chan net.Conn , 1 )
1414
15+ var lineEndingOpt string
16+
1517func Serve (c * lemon.CLI ) error {
1618 port := c .Port
1719 allowIP := c .Allow
20+ lineEndingOpt = c .LineEnding
1821 ra , err := iprange .New (allowIP )
1922 if err != nil {
2023 return err
You can’t perform that action at this time.
0 commit comments