Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CLI Improvements: Pagination, Shell Completion, Config, and Debug #383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
CLI Improvements: Pagination, Shell Completion, Config, and Debug #383
Changes from all commits
9f3970db0a958e63d8ab46db012ed124de3d6bfbd61b36b4e533aa99941e8427af9bf6512ee161ce25118c3787e709e2b779eb06c87802ba6e51e49a18748d02d92b8283da7c68e03022c4e686e18302c2234374812a392dc124d992826be653f5e39890d4a0cd1599a32a35aec5387fFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magic string + likely dead code path for config API URL.
"http://localhost:8080"is a magic string (guideline violation), but more importantly the override logic is fragile: if--api-urlflag default is""(empty), this branch is never true and the persistedapi_urlfrom~/.cloud/config.jsonis never applied. The precedence should be: CLI flag → config file → hardcoded default, not a string equality check against a specific default value.🔧 Proposed fix
As per coding guidelines: "Do not use magic numbers — use named constants instead."
📝 Committable suggestion
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: poyrazK/thecloud
Length of output: 148
🏁 Script executed:
Repository: poyrazK/thecloud
Length of output: 2846
🏁 Script executed:
Repository: poyrazK/thecloud
Length of output: 513
🏁 Script executed:
# Look at config.go to understand the config structure wc -l cmd/cloud/config.goRepository: poyrazK/thecloud
Length of output: 84
🏁 Script executed:
Repository: poyrazK/thecloud
Length of output: 1416
🏁 Script executed:
Repository: poyrazK/thecloud
Length of output: 3247
🏁 Script executed:
Repository: poyrazK/thecloud
Length of output: 1502
🏁 Script executed:
Repository: poyrazK/thecloud
Length of output: 42
🏁 Script executed:
Repository: poyrazK/thecloud
Length of output: 240
printOutputignores persistedoutputformat from config file.The
opts.Outputfield (line 77) is populated only from CLI flags with a default of"table"(main.go:86). When a user runscloud config set output yaml, that preference is saved tocfg.Outputin the config file, butprintOutputnever reads it. There is no sync betweencfg.Outputandopts.Output, so the persisted config setting is silently ignored every time a command callsprintOutput.To fix this, load the config file output preference early (e.g., in a
PersistentPreRunhook or before command execution) and setopts.Output = cfg.Outputwhen no explicit--outputflag is provided.🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
offset > 0withlimit == 0may trigger an unintended paginated call.The condition
limit > 0 || offset > 0routes topagFnwhen onlyoffsetis provided (e.g.,--offset 5without--limit). Depending on the SDK's behavior forlimit=0, this could return zero results or trigger an error, rather than the caller's expectation of "skip 5, return all".Consider requiring both
limitandoffsetto activate the paginated path, or defaultinglimitto a sensible value when onlyoffsetis specified.🤖 Prompt for AI Agents
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validate the
outputvalue inconfig set.Any arbitrary string is accepted for the
outputkey, but only"table","json", and"yaml"are valid. An invalid value persists silently and confuses every subsequent command.🔧 Proposed fix
🤖 Prompt for AI Agents
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.