Comments (7)
kwargs
weren't intended to be supported like that in current / prior versions.
kwargs it only there to pick up tmux_search_paths
and append_env_path
. Other than that, any instances of kwargs entering tmux_cmd
are a bug.
That said, I have no objection to adding it if it makes the experience more consistent / pleasant. However, I did want the signature on tmux_cmd
to be similar to subprocess' signature.
When I written the tmux_cmd
object, it was inspired by subprocess code in saltstack and pip (circa 2012/2013).
To play a bit of devil's advocate in terms of an intuitive, pythonic API: Do you know any other python subprocess-like (command) libraries that accept command line flags as kwargs?
from libtmux.
It does seem big that kwargs = {u'-t': u'$8'}
is being passed into tmux_cmd.
Think we could smoosh that back into args
?
from libtmux.
Thanks for the context and quick reply Tony! So args
should contain multiple values, as a proper list. I agree that kwargs
seems more optional or should be used for internal flags.
For your 2nd comment, about changing the Session.cmd
call? https://github.com/tony/libtmux/blob/master/libtmux/session.py#L75,L77
args = ['set-environment']
if '-t' not in args:
args.extend(['-t', self.id])
# args = ['set-environment', '-t', 'id']
This should probably not break backwards compatibility too much; it seems better to explicitly include the session id.
from libtmux.
Yes that's on the right track
Even better, args += ['-t', self.id]
(https://stackoverflow.com/questions/4176980/is-extend-faster-than)
I agree that kwargs seems more optional or should be used for internal flags.
It may be worth to put a comment in there that **kwargs
was only put for those options.
As an aside (not for right now): When I wrote this, I wanted to have a signature for commands like tmux_cmd('list-panes', '-a')
. After reflection, it sort of complicated the code. In the future, we may want to change the signature entirely to rely on a list variable instead of *args*. 1. because using
*argsmeans we can't use named keyword arguments. and 2. passing in the command (e.g.
['list-sessions']``) as a list is closer to subprocess' signatures. Which is probably going to be more intuitive to python programmers since that's the style used in the standard library.
from libtmux.
This should probably not break backwards compatibility too much; it seems better to explicitly include the session id.
The test suite is pretty solid. It tests against tmux itself and has enough coverage there's room to do internal refactors in the future (e.g. normalizing the tmux_cmd argument signature to be more consistent with subprocess')
from libtmux.
#65 is merged.
from libtmux.
Closing since #65 was the outcome.
We did not include kwargs in tmux_cmd
, but made a more targeted fix in Session.cmd()
from libtmux.
Related Issues (20)
- The parse of list-panes output breaks when the screen buffer contains pipe symbol HOT 6
- Tests failing on ppc64le HOT 2
- Tests failing on aarch64 HOT 2
- Tests failing on armv7l HOT 3
- Intermittent errors with tests on x86_64 / amd64 HOT 7
- Intermittent errors with tests on i586 (32bit)
- Is there any way to connect to a tmux session on a remote machine? HOT 1
- Intermittent / flaky test test_capture_pane
- select_pane not working correctly with multiple sessions HOT 2
- Drop Python 3.7 HOT 1
- `build(build-system)`: Remove `setuptools` build dependency
- unknown pytest option --doctest-docutils-modules HOT 7
- Unable to access server via WSGI HOT 4
- `TmuxObjectDoesNotExist` when creating `libtmux.Server().new_session(attach=True)` HOT 13
- Remove assert from __eq__ for windows HOT 5
- Tests failing with "FileNotFoundError: [Errno 2]" and "Unknown directive type: 'currentmodule' [myst.directive_unknown]" HOT 6
- Tests: Snapshots
- Options: Typed structures
- Environment: Add to `new-window`, `split-window`, `respawn-window`, `respawn-pane`
- No implicit exports from __init__.py HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libtmux.