Derek Dong
Software Developer
iRODS Consortium
June 13-16, 2023
iRODS User Group Meeting 2023
Chapel Hill, NC
The iRODS CLI we deserve
Overview
What are iCommands?
A polished product: iterated upon for a long time
Why is a new CLI necessary?
$ for i in $(compgen -G '*' | grep '\.cpp$' | sed 's/^i\(.*\)\.cpp/\1/')
do
ls ../../irods/lib/core/src/${i}Util* 2>/dev/null
done | wc -l
19
Goals for the new CLI
Progress on the new CLI - Comprehensibility
Progress on the new CLI - Comprehensibility
$ ./irods ls
C- '"''
C- potato
C- test3
bettername
testfilethree
testfiletwo
$ ./irods mv potato tomato
$ ./irods cp bettername bettername2
$ ./irods rm testfiletwo
Progress on the new CLI - Comprehensibility
$ ./irods ls -A
C- '"''
ACL - rods|tempZone|own
C- test3
ACL - rods|tempZone|own
C- tomato
ACL - rods|tempZone|own
bettername
ACL - rods#own
bettername2
ACL - rods#own
testfilethree
ACL - rods#own
Progress on the new CLI - Extensibility
namespace irods::cli
{
class command
{
public:
virtual ~command() = default;
virtual auto name() const noexcept -> std::string_view = 0;
virtual auto description() const noexcept -> std::string_view = 0;
virtual auto help_text() const noexcept -> std::string_view = 0;
virtual auto execute(const std::vector<std::string>& args) -> int = 0;
};
} // namespace irods::cli
Progress on the new CLI - Feature Parity/Modernization
Replace/extend the original iCommands
Use modern C++ libs
13~ commands with base functionality
All are written from scratch using modern C++ libs like irods::filesystem, libfmt, boost::program_options, etc.
Progress on the new CLI - Ease of Deployment
Optional command linking: static or dynamic!
Build output can be a single binary:
$ find . -type f \! -name '*.deb'
./irods
It can also be...
Progress on the new CLI - Ease of Deployment
$ find . -type f \! -name '*.deb'
./libirods_cli_put.so
./libirods_cli_mkdir.so
./libirods_cli_exit.so
./libirods_cli_get.so
./libirods_cli_cp.so
./libirods_cli_ls.so
./libirods_cli_touch.so
./libirods_cli_rm.so
./libirods_cli_tree.so
./irods
./libirods_cli_cd.so
./libirods_cli_pwd.so
./libirods_cli_mv.so
./libirods_cli_repl.so
Progress on the new CLI - Ease of Deployment
Modifying linking type from static to dynamic (or vice versa?)
Just make a small edit to the CMakeLists.txt at the root of the repo!
9 set(irods_static_subcommands)
10 set(irods_dynamic_subcommands ls put get repl ...)
9 set(irods_static_subcommands ls put get repl ...)
10 set(irods_dynamic_subcommands)
Example of linking all subcommands statically:
Dynamically:
Progress on the new CLI - Ease of Deployment
Demo - statically linked deployment
$ ls /lib/irods/plugins/cli/
$ ./irods ls
C- '"''
C- potato
C- test3
'
'"'''
bettername
testfilethree
testfiletwo
Progress on the new CLI - Ease of Deployment
Demo - loading plugins at runtime
$ ls /lib/irods/plugins/cli/
$ ./irods ls
Invalid command: ls
$ cp *.so /lib/irods/plugins/cli/
$ ./irods ls
C- '"''
C- potato
C- test3
'
'"'''
bettername
testfilethree
testfiletwo
Progress on the new CLI - Ease of Deployment
Anyone building can include/exclude commands freely
9 set(irods_static_subcommands ls)
10 set(irods_dynamic_subcommands put get repl ...)
$ ls /lib/irods/plugins/cli/
$ ./irods cd ..
Invalid command: cd
$ ./irods pwd
Invalid command: pwd
$ ./irods ls
C- '"''
C- test3
C- tomato
bettername
bettername2
testfilethree
Remaining work
Project is young; still many commands to implement
Several complex ones are still pending
iadmin
imeta, etc...
Future
Features beyond what the original iCommands have
JSON output on all the commands
Cross-platform compatibility
Thank you!
Questions?