[ruby/irb] Deprecate multi-irb commands
(https://github.com/ruby/irb/pull/654) * Deprecate multi-irb commands - Print deprecated message when any of the commands are used - Put related commands under `Multi-irb` category with a deprecated label * Update readme https://github.com/ruby/irb/commit/861731ac12
This commit is contained in:
parent
8ecd300e1e
commit
32e828bb4a
@ -18,6 +18,13 @@ module IRB
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def print_deprecated_warning
|
||||||
|
warn <<~MSG
|
||||||
|
Multi-irb commands are deprecated and will be removed in IRB 2.0.0. Please use workspace commands instead.
|
||||||
|
If you have any use case for multi-irb, please leave a comment at https://github.com/ruby/irb/issues/653
|
||||||
|
MSG
|
||||||
|
end
|
||||||
|
|
||||||
def extend_irb_context
|
def extend_irb_context
|
||||||
# this extension patches IRB context like IRB.CurrentContext
|
# this extension patches IRB context like IRB.CurrentContext
|
||||||
require_relative "../ext/multi-irb"
|
require_relative "../ext/multi-irb"
|
||||||
@ -25,38 +32,42 @@ module IRB
|
|||||||
end
|
end
|
||||||
|
|
||||||
class IrbCommand < MultiIRBCommand
|
class IrbCommand < MultiIRBCommand
|
||||||
category "IRB"
|
category "Multi-irb (DEPRECATED)"
|
||||||
description "Start a child IRB."
|
description "Start a child IRB."
|
||||||
|
|
||||||
def execute(*obj)
|
def execute(*obj)
|
||||||
|
print_deprecated_warning
|
||||||
IRB.irb(nil, *obj)
|
IRB.irb(nil, *obj)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Jobs < MultiIRBCommand
|
class Jobs < MultiIRBCommand
|
||||||
category "IRB"
|
category "Multi-irb (DEPRECATED)"
|
||||||
description "List of current sessions."
|
description "List of current sessions."
|
||||||
|
|
||||||
def execute
|
def execute
|
||||||
|
print_deprecated_warning
|
||||||
IRB.JobManager
|
IRB.JobManager
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Foreground < MultiIRBCommand
|
class Foreground < MultiIRBCommand
|
||||||
category "IRB"
|
category "Multi-irb (DEPRECATED)"
|
||||||
description "Switches to the session of the given number."
|
description "Switches to the session of the given number."
|
||||||
|
|
||||||
def execute(key = nil)
|
def execute(key = nil)
|
||||||
|
print_deprecated_warning
|
||||||
raise CommandArgumentError.new("Please specify the id of target IRB job (listed in the `jobs` command).") unless key
|
raise CommandArgumentError.new("Please specify the id of target IRB job (listed in the `jobs` command).") unless key
|
||||||
IRB.JobManager.switch(key)
|
IRB.JobManager.switch(key)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Kill < MultiIRBCommand
|
class Kill < MultiIRBCommand
|
||||||
category "IRB"
|
category "Multi-irb (DEPRECATED)"
|
||||||
description "Kills the session with the given number."
|
description "Kills the session with the given number."
|
||||||
|
|
||||||
def execute(*keys)
|
def execute(*keys)
|
||||||
|
print_deprecated_warning
|
||||||
IRB.JobManager.kill(*keys)
|
IRB.JobManager.kill(*keys)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user