Replace json-output boolean with type string option#26
Conversation
Co-authored-by: cryi <36897290+cryi@users.noreply.github.com>
|
@copilot Move format validation into util modify_file. Update modify file functions to actually use format. Make sure that util.modify file defaults to hjson if no format specified. Alias --file in case od modify to f so it is easier to type. Amd actually chanbe format in modify to type aliased to t. Description should say it is content type of file we are modifying. |
Co-authored-by: cryi <36897290+cryi@users.noreply.github.com>
Done in commit 22053e2:
|
|
@copilot Nah drop format option and replace it eith type. I want to type --type only. And output format is supposed to be replaced with type in both instance of modify_file so it is consistant. |
Co-authored-by: cryi <36897290+cryi@users.noreply.github.com>
Co-authored-by: cryi <36897290+cryi@users.noreply.github.com>
Done in commits 038aae8 and 3b9940d:
Users can now use |
|
@copilot I dont like tackling with _G. Cant we do it more elegantly? |
Co-authored-by: cryi <36897290+cryi@users.noreply.github.com>
Co-authored-by: cryi <36897290+cryi@users.noreply.github.com>
|
@copilot Just rename type argument to functions to content type. That way we dont have to use do or _G. We can still keep it as --type in args. That wont interfere. And fix the tst |
Co-authored-by: cryi <36897290+cryi@users.noreply.github.com>
Done in commit e8e3132:
|
Modify with support for json output
Replace the
json-outputboolean flag with atypestring option accepting "hjson" or "json" values in the modify command.Changes
app.lua:186-190): Changed from["json-output"]boolean totypestring type with aliastapp.lua:165-169): Added aliasffor--fileoption for easier typingutil.lua:227-231): Type validation moved toutil.modify_file()for better separation of concernscontent_type: Botham.modify_fileandutil.modify_filenow usecontent_typeparameter instead ofoutput_formatto avoid shadowing the built-intype()functiontypekey from modification mode filter (set/unset/add/remove)am.modify_file()as fifth parameterUsage
Default remains hjson when type is unspecified. Invalid values like
--type=xmlerror with: "type must be either 'hjson' or 'json'" (validation performed in util.modify_file).Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.