-
Notifications
You must be signed in to change notification settings - Fork 312
CLI and feedback enhancements #461
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: master
Are you sure you want to change the base?
CLI and feedback enhancements #461
Conversation
Thank you for your patches.
|
build |
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.
Create sperate patch for .gitignore file
@@ -62,6 +62,7 @@ static map<string, shared_ptr<FileBuffer>> g_filebuffer_map; | |||
static mutex g_mutex_map; | |||
static bool g_small_memory = true; | |||
|
|||
// [what is the point/value of this value?] | |||
#define MAGIC_PATH '>' |
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.
Mark avoid dead loop when search parent path
@@ -127,6 +128,9 @@ int DataBuffer::ref_other_buffer(std::shared_ptr<FileBuffer> p, size_t offset, s | |||
return 0; | |||
}; | |||
|
|||
/** | |||
* @brie Base class for FS things [whatever 'FS' means/is]. | |||
*/ |
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.
remove [...]
* Passing a bool like dir is bad style since it only controls flow. | ||
*/ | ||
virtual int split(const string &path, string *dir_part, string *name_part, bool dir=false) | ||
{ |
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.
use seperate patch to change outbackfile-> dir_part, outfilename -> filename_part
return 0; | ||
} | ||
|
||
protected: | ||
FSBasic() {} // enforce that this class is abstract base; only creatable via a superclass | ||
const char * m_ext = nullptr; |
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.
This one should be sperate patch
return -1; | ||
} | ||
|
||
if (m_use_bmap && m_bmap_filename.size() && !check_file_exist(m_bmap_filename)) { | ||
set_last_err_string("FB: bmap file not found"); | ||
set_last_err_string("FB: bmap file not found: " + m_bmap_filename); | ||
return -1; | ||
} |
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.
avoid two line should sperate patch, show improve error message
@@ -574,7 +574,7 @@ int CmdUsbCtx::look_for_match_device(const char *pro) | |||
|
|||
uuu_notify nt; | |||
nt.type = nt.NOTIFY_WAIT_FOR; | |||
nt.str = (char*)"Wait for Known USB"; | |||
nt.str = (char*)"DWait for Known USB"; | |||
call_notify(nt); |
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.
Why need 'D'
#endif | ||
|
||
} |
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.
this part should be sperate patch
uuu/buildincmd.cpp
Outdated
@@ -237,7 +237,7 @@ void BuiltInScriptMap::ShowCmds(FILE * const file) const | |||
fprintf(file, "|"); | |||
} | |||
} | |||
fprintf(file, ">"); | |||
//fprintf(file, ">"); | |||
} |
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.
why comment this
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.
Demostrate how to split/organize patches. tips: You use use "git add -p" to split patch. Need signed-of-by tag for each commits.
This is a big change so you may be hesitant to merge it. None the less and FWIW the tool is very useful, but I found the UX lacking including CLI, help info and user feedback. I reworked these aspects and as it was a significant change and the CLI code lacked structure (lacked componentization, uuu.cpp way too big, ...), I organized the code somewhat.
I started from NXP repo commit da3cd53 (16-May-2024, Fix PID 0159 device name from imx93 to imx91). Via backmerge, all files auto-merged except for uuu.cpp which had too many changes. To support review of the new CLI without deleting the old one, I renamed my uuu.cpp to cli.h so that uuu.cpp is mostly the same as it was. Can choose which CLI to use in main(). It's a half-measure but I didn't want to just delete the existing CLI code. I did update the old CLI to work with the other changes throughout.
There were about 20 commits after 16-may-2024 up to today (11-mar-2024). Since all files automerged other than uuu.cpp, only commits that modified uuu.cpp require manual merging. These are:
f764c01 fixes #443: -udev stdout should replace 70-uuu.rules rather than be appended to it
Resolution: Changes made manually in cli.h
5d77a61 Improve uuu help context
Resolution: No chagne required since new CLI code includes new help info
6c2141e Add dynamic
MAX_PROGRESS_WIDTH
global variable to handle long lines (#435)Resolution: **Skipped since couldn't understand intent of change. FYI This change would go into HorizontalScrollingFormatter.h; not cli.h
09fe178 remove ref global varible g_verbose in bmap.cpp
Resolution: Changes made manually in cli.h
c031b2a move global g_bmap_mode into libuuu
Resolution: Changes made manually in cli.h
CHANGES
o Theme: Command based CLI
- New CLI that is command-based; instead of switches that control high-level modes
- Segregation between install operations and other operations. Most options only apply to install. Makes it clearer what options go with what operations.
- install [OPTIONS] auto-detect-file
- install [OPTIONS] -s script-file ARGS
- install [OPTIONS] PRO: ARGS
- ls-devices: replaces -lsusb
- ls-builtin [BUILTIN]: moved built-in list out of -h
- cat-builtin BUILTIN: replaces -bshow
- help CONTEXT: organizes help info more consistently
- Renamed -d to --continuous: 'deamon' is too gargony
- Renamed -s to -i|--interactive: 'shell' is too gargony
- Renamed -m to --filter-path: more readable
- Renamed -ms to --filter-serial: more readable
- All multi-char options require two dashes: more consistent with other tools
o Theme: Enhance overwrite-based feedback
- Fixed horizontal scrolling of active command; it was only scrolling one or two chars left
- Show final status as "Successful" instead of "Done" since is more useful to know succeeded; not just done
o Theme: Enhance append-based feedback
- Show waiting for device message after validation so that it's not showing when never actually waiting for a device
- NOTIFY_CMD_INFO messages came out without context and % complete partially overwrote it; looked bad
- Added color and spacing to enhance readability
o Theme: Enhance CLI and script processing UX
- Overhauled error handling and reporting for CLI and script processing
- Provide 8000 limited feedback for bad input instead of outputting pages of info which is off-putting and confusing. Show limited help unless user asks for details.
- Edited help content for clarity and organized for uniformity
o Theme: Simplify logic and enhance code quality
- For overwriting feedback, leave the cursor at the end of the status area instead of trying to move it below the area on exit
- Factored out much of uuu.cpp into new files since it was too large and consisting of rather unrelated logic
- Renamed types that mentioned built-in scripts to be more generic since they are used for custom scripts as well as built-in script
- Add logger class and singleton to centralize logging logic
- Removed "using std" to make code easier to move between .cpp and .h files
- Changed feedback output to stderr so that commands that output info that one might want to capture does not include the info (unless they also capture stderr). In particular, 'help udev' (old -udev) outputs info that one wants in a file, but they don't want the app title or the instructions which both now go to stderr.
- Added header comments for functions that I learned what they did
o Theme: Support doxygen
- Enable doxygen output by adding @file to source files
- Enable doxygen output by adding Doxyfile; didn't understand how the existing Doxyfile.in file works
o Theme: Tried to fix auto-complete
- Auto-complete disabled for Linux since fails for input like: uuu f.uuu foo
- Auto-complete disabled for Windows since crashes for input line: uuu -autocomplete
o Theme: devops enhancements
- Minor changes to support building outside CI build system