Skip to content
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

Command line interface #2

Open
techtonik opened this issue Sep 17, 2015 · 2 comments
Open

Command line interface #2

techtonik opened this issue Sep 17, 2015 · 2 comments

Comments

@techtonik
Copy link

It would be extremely useful nice if this tool could provide a unified interactive command line interface across unix for most frequent commands.

For example, below is my typical session in unix environment (and the reason why I am here through PyPI) - I am trying to see a list of all human users on the system:

~# users
root
~# users -h
users: invalid option -- 'h'
Try `users --help' for more information.
~# users -help
users: invalid option -- 'h'
Try `users --help' for more information.
~# users -help
users: invalid option -- 'h'
Try `users --help' for more information.
~# users --help
Usage: users [OPTION]... [FILE]
Output who is currently logged in according to FILE.
If FILE is not specified, use /var/run/utmp.  /var/log/wtmp as FILE is common.

      --help     display this help and exit
      --version  output version information and exit

Report users bugs to [email protected]
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
Report users translation bugs to <http://translationproject.org/team/>
For complete documentation, run: info coreutils 'users invocation'
~# man users
...

And it is unsuccessful. What I'd expect is:

# pip install unix
# unix users
root
techtonik
# unix -h
unix users     --- list users
# unix users -h
unix users [--all]

options:
  --all   --- also list system users 

https://askubuntu.com/questions/257421/list-all-human-users

@fmenabe
Copy link
Owner

fmenabe commented Sep 21, 2015

This module aims (in disorder):

  • to provide an unified API across Unix systems for some basic operations (executing commands, manipulating files, ...)
  • to manage both localhost and remote host (via SSH) uniformly
  • for some operating systems (Linux, Solaris, *BSD, ...) implement specifics API
  • overload object for flexiblity (ex: host = Ubuntu(Linux(unix.Local()))). By using this system, it is possible to implement others APIs (ex: https://github.com/fmenabe/python-kvm, https://github.com/fmenabe/python-lxc)
  • order API elements (users, path, ...) in properties (ex: host.users.list(), host.path.exists('/tmp'))

Exposing APIs with a command-line interface (or even a REPL) is a nice idea! But, from the goals of this module it may not be simple and, as you pointed out, I don't even had time to make the documentation ... So I don't think it will be done soon.

Anyway, thanks for your contribution!

@techtonik
Copy link
Author

Well, with some effort being put into command line tool, I'd expect people to come up with PRs that close their immediate needs for the tool (and use / improve API as a result). Using API directly takes more time and effort, especially if it doesn't have docs. =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants