diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000..f52f79d --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,5 @@ +run: + timeout: 5m + skip-dirs: + - dist + - test \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..e9525d2 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. + // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp + + // List of extensions which should be recommended for users of this workspace. + "recommendations": [ + "golang.go" + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4b0c116 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "go.lintTool": "golangci-lint", + "editor.formatOnSave": true, + "editor.defaultFormatter": "golang.go" +} \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..3ededd1 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,40 @@ +# Contributing + +Pull requests are welcome. + +For major changes, please open an issue first to discuss what you would like to change. + +## Installation + +In order to build the application, you first need to [get Go CLI](https://go.dev/doc/install). + +The project was built using Go version `go1.19.1 windows/amd64`. If you are on a different version and experiencing any issues, please submit an issue regarding that. + +To build a binary or executable, run: + +``` +git clone https://github.com/devils2ndself/SSGo.git +cd SSGO +go build ssgo.go +``` +Or `go install` to install globally. + +## Formatting + +Anytime you perform changes that you want to contribute, please make sure the code is formatted appropriately. + +> Use `gofmt -s -w .` in order to format all code according to Go standards. + +## Linting + +We use [GoLangCI-Lint](https://golangci-lint.run/) in order to lint SSGo. You can see installation guide [here](https://golangci-lint.run/usage/install/). + +Linting is a part of a successful PR, so please make sure your code passes it. + +> Use `golangci-lint run` in order to lint-check all code in the directory. + +## IDE Integrations + +### VS Code + +It is recommended to install `golang.go` extension. This extension allows for automatic linting and on-save formatting. \ No newline at end of file diff --git a/README.md b/README.md index 40dc75f..61fc511 100644 --- a/README.md +++ b/README.md @@ -5,20 +5,6 @@ Lets you generate HTML files from either a single `.txt` file or multiple `.txt` Preview of generated HTML is available at https://devils2ndself.github.io/SSGo. -## Installation - -In order to build the application, you first need to [get Go CLI](https://go.dev/doc/install). - -To build a binary or executable, run: - -``` -git clone https://github.com/devils2ndself/SSGo.git -cd SSGO -go build ssgo.go -``` -Or `go install` to install globally. - - ## Usage - `ssgo --input [in] --output [out]` - Generate HTML from .txt or .md file at `in` path (can be a single .txt or .md file, or directory) to `out` path. @@ -65,9 +51,7 @@ These feaures are supported for files with an extension of '.md' ## Contributing -Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. - -> Please make sure to update tests as appropriate. +Please see [CONTRIBUTING.md](CONTRIBUTING.md). ## License [MIT](https://choosealicense.com/licenses/mit/) diff --git a/ssgo.go b/ssgo.go index d9b0554..6b1db39 100644 --- a/ssgo.go +++ b/ssgo.go @@ -12,11 +12,11 @@ const version string = "0.4" func main() { var ( - input string = "" - output string = utils.DefaultOutput - displayHelp bool = false - displayVersion bool = false - config string = "" + input string = "" + output string = utils.DefaultOutput + displayHelp bool = false + displayVersion bool = false + config string = "" ) // Flag initialization @@ -34,7 +34,7 @@ func main() { } else { if config != "" { utils.ProcessConfig(config) - }else if input != "" { + } else if input != "" { utils.ProcessInput(input, output) } else if displayHelp { utils.PrintHelp() @@ -44,4 +44,4 @@ func main() { fmt.Println("Invalid call. Use 'ssgo [-h | --help]' for available commands.") } } -} \ No newline at end of file +} diff --git a/utils/help.go b/utils/help.go index 246701e..204eb83 100644 --- a/utils/help.go +++ b/utils/help.go @@ -3,9 +3,9 @@ package utils import "fmt" const ( - InputHelpMessage string = "Path to a .txt / .md file OR a folder containing .txt / .md files to be turned into HTML" - OutputHelpMessage string = "Optional. Additionaly changes the output path of generated HTML" - HelpHelpMessage string = "Display detailed help message" + InputHelpMessage string = "Path to a .txt / .md file OR a folder containing .txt / .md files to be turned into HTML" + OutputHelpMessage string = "Optional. Additionaly changes the output path of generated HTML" + HelpHelpMessage string = "Display detailed help message" VersionHelpMessage string = "Display installed version of SSGo" ConfigHelpMessage string = "Path to a .json file containing SSGo configuration options" ) @@ -20,4 +20,4 @@ func PrintHelp() { fmt.Println("\n\t[-v | --version] \t- " + HelpHelpMessage) fmt.Println("\t[-h | --help] \t- " + VersionHelpMessage) fmt.Println("\t[-c | --config] \t- " + ConfigHelpMessage) -} \ No newline at end of file +} diff --git a/utils/html-generation.go b/utils/html-generation.go index 4876466..6f13a3d 100644 --- a/utils/html-generation.go +++ b/utils/html-generation.go @@ -13,8 +13,8 @@ import ( const ( beforeTitleHTML string = "\n\n
\n\n\n