diff --git a/flag.go b/flag.go index a9eaa53..4988887 100644 --- a/flag.go +++ b/flag.go @@ -7,12 +7,13 @@ import ( ) var ( + version bool file_output string file_input []string ) -// http://www.network-science.de/ascii/ -// is there any better way to print logo? plz contact us +// ascii img is build from http://www.network-science.de/ascii/ +// is there any better way to print logo? please contact us func print_logo() { fmt.Print("__ ___ _ ___ \n" + "/ _\\ ___ __ _ / __\\___ _ __ ___ | |__ / _ \\___ \n" + @@ -31,16 +32,25 @@ func print_logo() { // \__/\___|\__, \____/\___/|_| |_| |_|_.__/\____/\___/ // |_| +// is for cmd func dna_flag() { flag.StringVar(&file_output, "o", "a.nex", "output file") + flag.BoolVar(&version, "v", false, "version") flag.Usage = usage flag.Parse() + if version { + fmt.Println("SeqCombGo version: SeqCombGo/0.0.1") + os.Exit(0) + } file_input = flag.Args() // []string{"foo", "bar"} // 这里应该加个判断,如果输入不符合,后面的正则会报错 + if len(file_input) == 0 { + fmt.Println("please use it in right way! see -h for help") + os.Exit(0) + } print_logo() - fmt.Println() - fmt.Println("[input file:]", file_input) - fmt.Println("[output file:]", file_output) + fmt.Println("\n[import files:]", file_input) + fmt.Println("[export file :]", file_output) } func usage() { diff --git a/mix.go b/mix.go index 9f11796..38a4397 100644 --- a/mix.go +++ b/mix.go @@ -2,12 +2,15 @@ package main import "strings" +// dna 的整合 +// comb of dna func fas_mix(sum_nex []dna, sum_charset []charset) (map[string][]string, int, int) { - // dna 的整合 - // comb of dna + ntax := 0 nchar := sum_charset[len(sum_charset)-1].To + sum_dna := make(map[string][]string) + for _, v := range sum_nex { for k1 := range v.min { _, has := sum_dna[k1] @@ -24,7 +27,7 @@ func fas_mix(sum_nex []dna, sum_charset []charset) (map[string][]string, int, in sum_dna[k2][k] = v1 } else { sum_dna[k2][k] = strings.Repeat("?", v.count) - // 之前就没写错吗 + // 之前就没写错吗?已修复 } } }