SeqCombGo/flag.go

65 lines
1.8 KiB
Go
Raw Normal View History

2022-01-13 20:12:32 +08:00
package main
import (
"flag"
"fmt"
2022-01-15 22:03:56 +08:00
"os"
2022-01-13 20:12:32 +08:00
)
var (
2022-01-16 09:55:32 +08:00
version bool
2022-01-13 20:12:32 +08:00
file_output string
file_input []string
)
2022-01-16 09:55:32 +08:00
// ascii img is build from http://www.network-science.de/ascii/
// is there any better way to print logo? please contact us
2022-01-15 22:03:56 +08:00
func print_logo() {
fmt.Print("__ ___ _ ___ \n" +
"/ _\\ ___ __ _ / __\\___ _ __ ___ | |__ / _ \\___ \n" +
"\\ \\ / _ \\/ _` |/ / / _ \\| '_ ` _ \\| '_ \\ / /_\\/ _ \\ \n" +
"_\\ \\ __/ (_| / /__| (_) | | | | | | |_) / /_\\ (_) |\n" +
"\\__/\\___|\\__, \\____/\\___/|_| |_| |_|_.__/\\____/\\___/ \n" +
" |_| \n")
fmt.Println(" Sequence Combination tool written in Golang")
2022-01-18 22:19:16 +08:00
fmt.Println("Version 0.0.1 Authors: An, G; Zhang, G License: GPL")
2022-01-15 22:03:56 +08:00
}
// __ ___ _ ___
// / _\ ___ __ _ / __\___ _ __ ___ | |__ / _ \___
// \ \ / _ \/ _` |/ / / _ \| '_ ` _ \| '_ \ / /_\/ _ \
// _\ \ __/ (_| / /__| (_) | | | | | | |_) / /_\\ (_) |
// \__/\___|\__, \____/\___/|_| |_| |_|_.__/\____/\___/
// |_|
2022-01-16 09:55:32 +08:00
// is for cmd
2022-01-13 20:12:32 +08:00
func dna_flag() {
2022-01-15 19:10:12 +08:00
flag.StringVar(&file_output, "o", "a.nex", "output file")
2022-01-16 09:55:32 +08:00
flag.BoolVar(&version, "v", false, "version")
2022-01-15 22:03:56 +08:00
flag.Usage = usage
2022-01-13 20:12:32 +08:00
flag.Parse()
2022-01-16 09:55:32 +08:00
if version {
fmt.Println("SeqCombGo version: SeqCombGo/0.0.1")
os.Exit(0)
}
2022-01-13 20:12:32 +08:00
file_input = flag.Args() // []string{"foo", "bar"}
2022-01-15 22:03:56 +08:00
// 这里应该加个判断,如果输入不符合,后面的正则会报错
2022-01-16 09:55:32 +08:00
if len(file_input) == 0 {
fmt.Println("please use it in right way! see -h for help")
os.Exit(0)
}
2022-01-15 22:03:56 +08:00
print_logo()
2022-01-16 09:55:32 +08:00
fmt.Println("\n[import files:]", file_input)
fmt.Println("[export file :]", file_output)
2022-01-13 20:12:32 +08:00
}
2022-01-15 22:03:56 +08:00
func usage() {
print_logo()
fmt.Fprintf(os.Stderr, `
Example:
SeqCombGo -o export.nex import1.fas import2.fas ...
Options:
`)
flag.PrintDefaults()
}