Sha256: 2881cfa7b5f786fefb135330c569879c043ceb47ffd419f9b540e470924aff18

Contents?: true

Size: 639 Bytes

Versions: 3

Compression:

Stored size: 639 Bytes

Contents

require 'kontena/plugin/shell/command'

module Kontena::Plugin
  module Shell
    class ContextTopCommand < Command
      command '/'
      description 'Clear context'
      help "Go to top in context.\n\nYou can also directly call other commands without switching context first by using for example #{Kontena.pastel.yellow('/ master ls')}"

      def execute
        if args[1] && session
          old_context = context.to_a.clone
          context.top
          session.run_command(args[1..-1].join(' '))
          context.concat(old_context) if context.empty?
        else
          context.top
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kontena-plugin-shell-0.2.0 lib/kontena/plugin/shell/commands/context_top.rb
kontena-plugin-shell-0.1.3 lib/kontena/plugin/shell/commands/context_top.rb
kontena-plugin-shell-0.1.2 lib/kontena/plugin/shell/commands/context_top.rb