fix minor bug, add todos

This commit is contained in:
Christoph Herb
2024-10-10 00:34:56 +02:00
parent 63e5727b6f
commit 59152be7b3
2 changed files with 15 additions and 4 deletions

View File

@@ -56,6 +56,17 @@ To terminate the current server simply press `CTRL-C`.
<img src="./.github/docs/examples.png" alt="examples" width="1000"/> <img src="./.github/docs/examples.png" alt="examples" width="1000"/>
## 🐛 Known TODOs / Bugs
* [ ] GitHub alert block
```md
> [!NOTE]
> Useful information that users should know, even when skimming content.
```
* [ ] Checkboxes (like in this todo list)
* [ ] Tests and refactoring
## 📌 Similar tools ## 📌 Similar tools
This tool is, like the name already says, a reimplementation of [grip](https://github.com/joeyespo/grip) in go and without using the web API of GitHub. This tool is, like the name already says, a reimplementation of [grip](https://github.com/joeyespo/grip) in go and without using the web API of GitHub.

View File

@@ -6,7 +6,7 @@ import (
"io" "io"
"log" "log"
"net/http" "net/http"
"path" "net/url"
"path/filepath" "path/filepath"
"regexp" "regexp"
"text/template" "text/template"
@@ -52,7 +52,7 @@ func (client *Client) Serve(file string) error {
} }
}) })
addr := fmt.Sprintf("http://localhost:%d", client.Port) addr := fmt.Sprintf("http://localhost:%d/", client.Port)
if file == "" { if file == "" {
// If README.md exists then open README.md at beginning // If README.md exists then open README.md at beginning
readme := "README.md" readme := "README.md"
@@ -61,10 +61,10 @@ func (client *Client) Serve(file string) error {
defer f.Close() defer f.Close()
} }
if err == nil && client.OpenReadme { if err == nil && client.OpenReadme {
addr = path.Join(addr, readme) addr, _ = url.JoinPath(addr, readme)
} }
} else { } else {
addr = path.Join(addr, file) addr, _ = url.JoinPath(addr, file)
} }
fmt.Printf("🚀 Starting server: %s\n", addr) fmt.Printf("🚀 Starting server: %s\n", addr)