-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change to the way of writing using receiver.
- Loading branch information
Showing
10 changed files
with
101 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package file | ||
|
||
import ( | ||
"path/filepath" | ||
"io/ioutil" | ||
"errors" | ||
) | ||
|
||
type File struct { | ||
Data []byte | ||
} | ||
|
||
func (f *File) Open(path string) error { | ||
ext := filepath.Ext(path) | ||
|
||
if ext != ".md" && ext != ".markdown" { | ||
return errors.New("This file is not in markdown format.") | ||
} | ||
|
||
data, err := ioutil.ReadFile(path) | ||
|
||
if err != nil { | ||
return errors.New("Can't open this file.") | ||
} | ||
|
||
f.Data = data | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package util | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
|
||
"github.com/atotto/clipboard" | ||
) | ||
|
||
func Copy(text string) error { | ||
err := clipboard.WriteAll(text) | ||
|
||
if err != nil { | ||
log.Fatal(err) | ||
return err | ||
} | ||
|
||
fmt.Println("Copied to clipboard!") | ||
return nil | ||
} |