Skip to content

Commit

Permalink
Merge pull request #60 from Borwe/refactor
Browse files Browse the repository at this point in the history
Refactor by setting single global text for Help
  • Loading branch information
AvicennaJr authored Oct 3, 2023
2 parents 4ac4229 + d07b6dc commit 3037476
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,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() {
Expand All @@ -35,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)
Expand All @@ -71,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)
}
}

0 comments on commit 3037476

Please sign in to comment.