Junbo-Zheng opened a new pull request, #3656:
URL: https://github.com/apache/nuttx-apps/pull/3656

   ## Summary
   
   Add a `du` command to nshlib that recursively summarizes the size of each 
path argument in 1K-blocks, or in human-readable form with `-h`.  Also supports 
`-s` (summary only), `-a` (all files), `-d N` (max-depth), and `-h`, matching 
GNU `du` semantics.
   
   ## Impact
   
   - **Users**: New `du` command in NSH; no existing command or behavior 
changed.
   
   ## Testing
   
   Built and run on sim:nsh (host Ubuntu 22.04) with cmake build:
   ```bash
   cmake -B out/nuttx_sim_nsh -S nuttx -DBOARD_CONFIG=sim:nsh -GNinja
   ninja -C out/nuttx_sim_nsh
   ./out/nuttx_sim_nsh/nuttx
   ```
   
   
   `CONFIG_LIBC_FLOATINGPOINT` off (sim default) -- `-h` uses integer K/M/G:
   ```bash
   nsh> du
   397449  /data/test/elf
   71993   /data/test/coredump
   5       /data/test/log2
   3251    /data/test/log1
   472700  /data/test
   
   nsh> du -h
   388M  /data/test/elf
   70M   /data/test/coredump
   4K    /data/test/log2
   3M    /data/test/log1
   461M  /data/test
   ```
   
   `CONFIG_LIBC_FLOATINGPOINT=y` in sim:nsh defconl:
   ```bash
   nsh> du -h
   388.1M  /data/test/elf
   70.3M   /data/test/coredump
   4.2K    /data/test/log2
   3.2M    /data/test/log1
   461.6M  /data/test
   ```
   
   Host Ubuntu 22.04 `du` on the same directory:
   ```
   $ du
   397456  ./elf
   72000   ./coredump
   8       ./log2
   3252    ./log1
   472720  .
   
   $ du -h
   389M  ./elf
   71M   ./coredump
   8.0K  ./log2
   3.2M  ./log1
   462M  .
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to