diff --git a/main.go b/main.go index 7cc9064..7bc900c 100644 --- a/main.go +++ b/main.go @@ -2,7 +2,6 @@ package main import ( "fmt" - "io/ioutil" "os" "strings" @@ -19,6 +18,16 @@ var ( Version = styles.VersionStyle.Render("v0.5.1") Author = styles.AuthorStyle.Render("by Avicenna") NewLogo = lipgloss.JoinVertical(lipgloss.Center, Title, lipgloss.JoinHorizontal(lipgloss.Center, Author, " | ", Version)) + Help = styles.HelpStyle.Italic(false).Render(fmt.Sprintf(`💡 Namna ya kutumia Nuru: + %s: Kuanza programu ya Nuru + %s: Kuendesha faili la Nuru + %s: Kusoma nyaraka za Nuru + %s: Kufahamu toleo la Nuru +`, + styles.HelpStyle.Bold(true).Render("nuru"), + styles.HelpStyle.Bold(true).Render("nuru jinaLaFile.nr"), + styles.HelpStyle.Bold(true).Render("nuru --nyaraka"), + styles.HelpStyle.Bold(true).Render("nuru --toleo"))) ) func main() { @@ -36,16 +45,7 @@ func main() { switch args[1] { case "msaada", "-msaada", "--msaada", "help", "-help", "--help", "-h": - fmt.Println(styles.HelpStyle.Italic(false).Render(fmt.Sprintf(`💡 Namna ya kutumia Nuru: - %s: Kuanza programu ya Nuru - %s: Kuendesha faili la Nuru - %s: Kusoma nyaraka za Nuru - %s: Kufahamu toleo la Nuru -`, - styles.HelpStyle.Bold(true).Render("nuru"), - styles.HelpStyle.Bold(true).Render("nuru jinaLaFile.nr"), - styles.HelpStyle.Bold(true).Render("nuru --nyaraka"), - styles.HelpStyle.Bold(true).Render("nuru --toleo")))) + fmt.Println(Help) os.Exit(0) case "version", "-version", "--version", "-v", "v", "--toleo", "-toleo": fmt.Println(NewLogo) @@ -58,7 +58,7 @@ func main() { file := args[1] if strings.HasSuffix(file, "nr") || strings.HasSuffix(file, ".sw") { - contents, err := ioutil.ReadFile(file) + contents, err := os.ReadFile(file) if err != nil { fmt.Println(styles.ErrorStyle.Render("Error: Nuru imeshindwa kusoma faili: ", args[1])) os.Exit(0) @@ -72,16 +72,7 @@ func main() { } else { fmt.Println(styles.ErrorStyle.Render("Error: Operesheni imeshindikana boss.")) - fmt.Println(styles.HelpStyle.Italic(false).Render(fmt.Sprintf(`💡 Namna ya kutumia Nuru: - %s: Kuanza programu ya Nuru - %s: Kuendesha faili la Nuru - %s: Kusoma nyaraka za Nuru - %s: Kufahamu toleo la Nuru -`, - styles.HelpStyle.Bold(true).Render("nuru"), - styles.HelpStyle.Bold(true).Render("nuru jinaLaFile.nr"), - styles.HelpStyle.Bold(true).Render("nuru --nyaraka"), - styles.HelpStyle.Bold(true).Render("nuru --toleo")))) + fmt.Println(Help) os.Exit(0) } }