Skip to content

Commit

Permalink
Merge pull request #62 from AvicennaJr/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
AvicennaJr authored Oct 3, 2023
2 parents a18cce4 + 3037476 commit c7d16e0
Showing 1 changed file with 13 additions and 22 deletions.
35 changes: 13 additions & 22 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"fmt"
"io/ioutil"
"os"
"strings"

Expand All @@ -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() {
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
}
}

0 comments on commit c7d16e0

Please sign in to comment.