Minor doc tweaks. v0.0.2

main v0.0.2
Sean Hickey 2022-02-27 02:12:55 -08:00
parent fd2e59f47a
commit c14e0dfcab
6 changed files with 35 additions and 3 deletions

3
.gitignore vendored
View File

@ -1,2 +1,5 @@
# Build output
*.test
# Emacs
*~

View File

@ -1,7 +1,6 @@
# BSD 2-Clause License
Copyright (c) 2022, Sean Hickey (Wisellama)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

View File

@ -1,7 +1,10 @@
all: test
test:
test: linter
go test
linter:
golangci-lint run
goimports_everything:
find . -name "*.go" -exec goimports -w {} \;

View File

@ -1,7 +1,7 @@
# gosimpleconf
```sh
go get gitea.wisellama.rocks/Wisellama/gosimpleconf@v0.0.1
go get gitea.wisellama.rocks/Wisellama/gosimpleconf@v0.0.2
```
This is a small library for parsing super simple configuration files.
@ -17,6 +17,28 @@ map for you to do whatever your program wants with them. If you need a
value to not be a string, you will have to convert the value from a
string as needed for your program (e.g. using the `strconv` library).
## Example
Here's an example config file `file.conf`
```conf
url = www.wisellama.rocks
number_of_widgets = 1337
pi = 3.141592653589793238462643383
environment = production
```
Then to load that config file into a map:
```go
configMap, err := gosimpleconf.Load("file.conf")
```
Then everything is a string. You can parse it as needed.
```go
var piStr string = configMap["pi"]
pi, err := strconv.ParseFloat(value, 64)
```
## Why?
I've always seen configuration files similar to this show up in
@ -37,3 +59,8 @@ it unless Go fundamentally breaks the language in the future. So while
the project may eventually look like it has been abandoned, it is
rather simply "complete". (*gasp* I know, such a rare thing in the
software world).
## License
This project is licensed under the 2-Clause BSD License (a permissive
open source license). See `License.md` for the full text.