Permalink
Browse files

added support for renaming sessions

  • Loading branch information...
dominikh committed Jul 25, 2010
1 parent c9f6940 commit 7bffeb5e6de1fc5005861b8082a5984ff0a83c17
Showing with 17 additions and 1 deletion.
  1. +17 −1 lib/tmux/session.rb
View
@@ -95,8 +95,19 @@ def eql?(other)
self == other
end
+ # @overload name
+ # @return [String]
+ # @overload name=(new_name)
+ # Renames the session.
+ #
+ # @todo escape name
+ # @todo check return value. any conflicts? [see also {https://sourceforge.net/tracker/?func=detail&aid=3034296&group_id=200378&atid=973262}]
+ # @return [String]
+ # @tmux rename-session
# @return [String]
- attr_reader :name
+ attr_accessor :name
+ undef_method "name"
+ undef_method "name="
# @return [Server]
attr_reader :server
# @return [OptionsList]
@@ -109,6 +120,11 @@ def initialize(server, name)
@options = OptionsList.new(:session, self, false)
end
+ def name=(new_name)
+ ret = @server.invoke_command("rename-session -t #{identifier} '#{new_name}'")
+ @name = new_name
+ end
+
# @return [String]
attr_reader :identifier
undef_method "identifier"

0 comments on commit 7bffeb5

Please sign in to comment.