Skip to content

Commit 3037476

Browse files
authored
Merge pull request #60 from Borwe/refactor
Refactor by setting single global text for Help
2 parents 4ac4229 + d07b6dc commit 3037476

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

main.go

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ var (
1818
Version = styles.VersionStyle.Render("v0.5.1")
1919
Author = styles.AuthorStyle.Render("by Avicenna")
2020
NewLogo = lipgloss.JoinVertical(lipgloss.Center, Title, lipgloss.JoinHorizontal(lipgloss.Center, Author, " | ", Version))
21+
Help = styles.HelpStyle.Italic(false).Render(fmt.Sprintf(`💡 Namna ya kutumia Nuru:
22+
%s: Kuanza programu ya Nuru
23+
%s: Kuendesha faili la Nuru
24+
%s: Kusoma nyaraka za Nuru
25+
%s: Kufahamu toleo la Nuru
26+
`,
27+
styles.HelpStyle.Bold(true).Render("nuru"),
28+
styles.HelpStyle.Bold(true).Render("nuru jinaLaFile.nr"),
29+
styles.HelpStyle.Bold(true).Render("nuru --nyaraka"),
30+
styles.HelpStyle.Bold(true).Render("nuru --toleo")))
2131
)
2232

2333
func main() {
@@ -35,16 +45,7 @@ func main() {
3545

3646
switch args[1] {
3747
case "msaada", "-msaada", "--msaada", "help", "-help", "--help", "-h":
38-
fmt.Println(styles.HelpStyle.Italic(false).Render(fmt.Sprintf(`💡 Namna ya kutumia Nuru:
39-
%s: Kuanza programu ya Nuru
40-
%s: Kuendesha faili la Nuru
41-
%s: Kusoma nyaraka za Nuru
42-
%s: Kufahamu toleo la Nuru
43-
`,
44-
styles.HelpStyle.Bold(true).Render("nuru"),
45-
styles.HelpStyle.Bold(true).Render("nuru jinaLaFile.nr"),
46-
styles.HelpStyle.Bold(true).Render("nuru --nyaraka"),
47-
styles.HelpStyle.Bold(true).Render("nuru --toleo"))))
48+
fmt.Println(Help)
4849
os.Exit(0)
4950
case "version", "-version", "--version", "-v", "v", "--toleo", "-toleo":
5051
fmt.Println(NewLogo)
@@ -71,16 +72,7 @@ func main() {
7172

7273
} else {
7374
fmt.Println(styles.ErrorStyle.Render("Error: Operesheni imeshindikana boss."))
74-
fmt.Println(styles.HelpStyle.Italic(false).Render(fmt.Sprintf(`💡 Namna ya kutumia Nuru:
75-
%s: Kuanza programu ya Nuru
76-
%s: Kuendesha faili la Nuru
77-
%s: Kusoma nyaraka za Nuru
78-
%s: Kufahamu toleo la Nuru
79-
`,
80-
styles.HelpStyle.Bold(true).Render("nuru"),
81-
styles.HelpStyle.Bold(true).Render("nuru jinaLaFile.nr"),
82-
styles.HelpStyle.Bold(true).Render("nuru --nyaraka"),
83-
styles.HelpStyle.Bold(true).Render("nuru --toleo"))))
75+
fmt.Println(Help)
8476
os.Exit(0)
8577
}
8678
}

0 commit comments

Comments
 (0)