-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
89 lines (71 loc) · 2 KB
/
main.go
File metadata and controls
89 lines (71 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package main
import (
"flag"
"os"
"fmt"
"log"
"github.com/imf4ll/ghost/modes"
)
var (
fullscreen,
selection,
selectiongui,
clipboard,
output,
upload,
version,
file bool
display int
save string
)
func init() {
flag.BoolVar(&fullscreen, "f", false, "Fullscreen mode")
flag.BoolVar(&selection, "s", false, "Selection mode")
flag.BoolVar(&selectiongui, "g", false, "Selection with GUI mode")
flag.IntVar(&display, "d", -1, "Display mode")
flag.BoolVar(&clipboard, "c", false, "Save to clipboard")
flag.StringVar(&save, "S", "/tmp/screenshot.png", "Save to file")
flag.BoolVar(&file, "F", false, "Save to file on default images path")
flag.BoolVar(&output, "o", false, "Output to stdout")
flag.BoolVar(&upload, "u", false, "Submit to AnonFiles")
flag.BoolVar(&version, "v", false, "Version")
flag.Usage = func() {
fmt.Fprintf(os.Stdout, `Usage:
ghost [flags]
Description:
A tool to take screenshots
Flags:
-f Fullscreen mode
-s Selection mode
-g Selection with GUI mode
-d Display mode (int)
-c Save to clipboard
-S Save to file (string)
-F Save to file on default images path
-o Output to stdout
-u Submit to AnonFiles
-v Print version
`)
}
flag.Parse()
}
func main() {
if version {
fmt.Println("\nCurrent version:\n v1.1.3")
os.Exit(3)
}
if (!clipboard && !file && save == "" && !output && !upload) {
log.Fatalln("You need to specify at least a save method, check 'ghost --help'.")
}
if fullscreen {
modes.Fullscreen(save, clipboard, output, upload, file)
} else if selection {
modes.Selection(save, clipboard, output, upload, file)
} else if selectiongui {
modes.SelectionGUI(save, clipboard, output, upload, file)
} else if display != -1 {
modes.Display(save, clipboard, output, upload, file, display)
} else {
flag.Usage()
}
}