On 12/01, Sergey Senozhatsky wrote:
On Wed, Dec 1, 2021 at 11:17 AM Namjae Jeon <linkinjeon@xxxxxxxxxx> wrote:
> I've been working on the unification of all ksmbd-tools programs into a
> single 'ksmbdctl' binary, and I would like to invite everyone to test
> and/or provide me feedback on the implementation.
Why?
Hi Sergey. The reasoning was in the commit message included in the
email, but I'll quote it here and elaborate:
...
The intention is to make it more like other modern tools (e.g. git,
nvme, virsh, etc) which have more clear user interface, readable
commands, and also makes it easier to script.
Example commands:
# ksmbdctl share add myshare -o "guest ok=yes, writable=yes, path=/mnt/data"
# ksmbdctl user add myuser
# ksmbdctl user add -i $HOME/mysmb.conf anotheruser
# ksmbdctl daemon start
Besides adding a new "share list" command, any previously working
functionality shouldn't be affected.
- clearer user interface: having a single binary looks much clearer than
having several separate programs when, e.g. the user is looking which
program does what.
- more readable commands: continuing from topic above, the situation is
improved especially when you see that, e.g., the ksmbd.addshare program
also updates and deletes shares. With this unification, it is way more
intuitive to use:
---- snip ----
% ./ksmbdctl share
Usage: ksmbdctl share <subcommand> <args> [options]
Share management.
List of available subcommands:
add Add a share
delete Delete a share
update Update a share
list List the names of all shares available
---- snip ----
- easier to script: having a defined structure for the commands makes it
easier for users to automate ksmbd deployments. This is more of a
consequence of the topics above, but should count as an advantage IMO.
As I also said in the commit message, the idea is to have an abstract
implementation so we can add/manage/remove commands without having to
rely on each command specifics. Of course, this shouldn't have much/any
effect for users, but will have great benefit for developers.
And, again, I ask you to consider the applications I used as inspiration
for such change, such as git, nvme-cli, virsh, which are tools that many
of us use every day and, e.g. "git help -a | grep "^ " | wc -l" says
there are about 144 git commands, but I sure don't have 144 git binaries
spread over my system.
I hope to have made myself clearer now, but please let me know
otherwise.
Cheers,
Enzo