run

in lib/gdk/command/switch.rb [8:37]


      def run(args = [])
        branch = args.pop

        unless branch
          out.warn('Usage: gdk switch [BRANCH_NAME]')
          return false
        end

        
        config.bury!('gitlab.default_branch', branch)

        success = GDK::Hooks.with_hooks(config.gdk.update_hooks, 'gdk switch') do
          run_rake('update_branch', branch)
        end

        unless success
          GDK::Output.error('Failed to switch branches.', report_error: false)
          display_help_message
          return false
        end

        color_branch = out.wrap_in_color(branch, Output::COLOR_CODE_YELLOW)
        GDK::Output.success("Switched to #{color_branch}.")

        true
      rescue Support::Rake::TaskWithLogger::LoggerError => e
        e.print!
        false
      end