Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ac6ad72
feat(cli): Implement cli parsing
TheRootDaemon Jul 2, 2026
431fc10
feat(cli): Extend cli flags, argument parsing
TheRootDaemon Jul 3, 2026
5fa3f8e
feat(cli): Implement update, list, listall, search, listplatforms, li…
TheRootDaemon Jul 3, 2026
b3fd2c2
feat(cli): Implement page renders
TheRootDaemon Jul 3, 2026
6adab4b
refactor(cli): Move entrypoint handling to internal/app
TheRootDaemon Jul 4, 2026
88b3baa
fix: Add \n, refactor displaying platforms at entry point
TheRootDaemon Jul 5, 2026
b945059
perf: Cache raw page content to avoid redundant disk reads
TheRootDaemon Jul 6, 2026
2647d31
fix: use filepath.Dir/Base with os.OpenRoot for sandboxed file reads
TheRootDaemon Jul 6, 2026
fcdfe3e
chore(cache): Improve logging, addresses #8
TheRootDaemon Jul 8, 2026
7e14ff7
fix(config): Gracefully handle missing/partial configs, Resolves #9
TheRootDaemon Jul 8, 2026
ce7df04
chore(config): Improve logging, addresses #8
TheRootDaemon Jul 8, 2026
e266ab9
chore(upstream): Improve logging, addresses #8
TheRootDaemon Jul 8, 2026
641b911
fix(cache): Normalize .zip entries before mkdirall, Resolves #10
TheRootDaemon Jul 8, 2026
9bfd91d
chore(render): Improve logging, Addresses #8
TheRootDaemon Jul 9, 2026
83c6c6d
feat(render): Add page validation, Resolves #11
TheRootDaemon Jul 9, 2026
dda9707
refactor(render): Split code in feature specific files
TheRootDaemon Jul 13, 2026
8df4d5f
feat(render): Renders inlinde code spans, urls. Resolves #12
TheRootDaemon Jul 13, 2026
4b6a607
fix(logging): Turn noisy info logs to debug logs
TheRootDaemon Jul 13, 2026
8077b8b
refactor(render): Reduce cyclomatic complexity for Render, Resolves #14
TheRootDaemon Jul 13, 2026
960bfae
tests(render): Reorganize tests and improve package structure
TheRootDaemon Jul 13, 2026
d1ca78d
Merge branch 'main' into cli
TheRootDaemon Jul 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions cmd/cli.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package cmd

// CLI holds all parsed command-line flags and positional arguments.
type CLI struct {
// operations

// Page holds the positional arguments (page names to look up).
Page []string

// Update requests a cache update.
Update bool

// List requests listing pages for the current platform.
List bool

// ListAll requests listing all pages across all platforms.
ListAll bool

// Search requests a keyword search across pages.
Search string

// ListPlatforms requests listing available platforms.
ListPlatforms bool

// ListLanguages requests listing installed languages.
ListLanguages bool

// Info requests showing cache information.
Info bool

// Render requests rendering a local markdown file.
Render string

// CleanCache requests interactively cleaning the cache.
CleanCache bool

// GenConfig requests printing the default configuration.
GenConfig bool

// ConfigPath requests printing the config file path.
ConfigPath bool

// ShowVersion requests printing the version string.
ShowVersion bool

// ShowHelp requests printing the help text.
ShowHelp bool

// Options

// Platform overrides the platform used for page lookup.
Platform string

// Languages overrides the language list.
Languages []string

// ShortOptions requests displaying short option forms.
ShortOptions bool

// LongOptions requests displaying long option forms.
LongOptions bool

// Edit requests displaying a GitHub edit link.
Edit bool

// Offline suppresses automatic cache updates.
Offline bool

// Compact strips empty lines from output.
Compact bool

// Raw prints pages in raw markdown.
Raw bool

// Quiet suppresses informational and warning messages.
Quiet bool

// Verbose controls the verbosity level (0–2).
Verbose uint8

// Color controls when to enable color output: auto, always, never.
Color string

// Config specifies an alternative config file path.
Config string
}
31 changes: 31 additions & 0 deletions cmd/count_value.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package cmd

import "fmt"

// countValue implements flag.Value for a counter.
//
// Each occurrence of the associated flag increments the counter by one,
// allowing flags such as:
//
// --verbose
// --verbose --verbose
//
// to be represented as increasing verbosity levels.
type countValue struct {
count *uint8
}

// String returns the current counter value as a string.
func (v *countValue) String() string {
if v.count == nil {
return "0"
}

return fmt.Sprintf("%d", *v.count)
}

// Set increments the counter each time the flag is encountered.
func (v *countValue) Set(string) error {
*v.count++
return nil
}
30 changes: 30 additions & 0 deletions cmd/list_values.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package cmd

import "strings"

// stringListValue implements flag.
// Value for a string slice.
// It supports both repeated flags (-L de -L pl)
// and comma-separated values (-L de,pl).
type stringListValue struct {
values *[]string
}

// String returns the comma-separated representation of the value.
func (v *stringListValue) String() string {
if v.values == nil {
return ""
}
return strings.Join(*v.values, ",")
}

// Set appends one or more comma-separated values to the slice
func (v *stringListValue) Set(s string) error {
for part := range strings.SplitSeq(s, ",") {
part = strings.TrimSpace(part)
if part != "" {
*v.values = append(*v.values, part)
}
}
return nil
}
Loading
Loading