Sha256: a2733608afbb5bcb1c3fe502ba28b4bdf08d45a555bffb3cb2e8e94e0fa5e331

Contents?: true

Size: 1.61 KB

Versions: 1

Compression:

Stored size: 1.61 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

# encoding=utf-8

require_relative 'block_types'

class AppInterrupt < StandardError; end
class BlockMissing < StandardError; end

class ArgPro
  ActFileIsMissing = :file_missing
  ActFind = :find
  ActSetBlockName = :block_name
  ActSetFileName = :set_filename
  ActSetOption = :set_option
  ActSetPath = :set_path
  ArgIsOption = :option
  ArgIsPosition = :position
  CallProcess = :proc_name
  ConvertValue = :convert
end

class ExecutionStreams
  STD_ERR = :stderr
  STD_IN  = :stdin
  STD_OUT = :stdout
end

IndexedLine = Struct.new(:index, :line) do
  def to_s
    line
  end
end

class LinkKeys
  BLOCK = 'block'
  EVAL = 'eval'
  EXEC = 'exec'
  FILE = 'file'
  LOAD = 'load'
  NEXT_BLOCK = 'next_block'
  RETURN = 'return'
  SAVE = 'save'
  VARS = 'vars'
end

class LoadFile
  EXIT = :exit
  LOAD = true
  REUSE = false
end

LoadFileLinkState = Struct.new(:load_file, :link_state)

class MenuOptions
  YES = 1
  NO = 2
  SCRIPT_TO_CLIPBOARD = 3
  SAVE_SCRIPT = 4
end

class MenuState
  BACK = :back
  CONTINUE = :continue
  EDIT = :edit
  EXIT = :exit
  HISTORY = :history
  LOAD = :load
  SAVE = :save
  SHELL = :shell
  VIEW = :view
end

# a struct to hold the data for a single line
NestedLine = Struct.new(:text, :depth) do
  def to_s
    text
  end
end

# selected block and subsequent menu state
#
SelectedBlockMenuState = Struct.new(:block, :source, :state)

SHELL_COLOR_OPTIONS = {
  BlockType::BASH => :menu_bash_color,
  BlockType::LINK => :menu_link_color,
  BlockType::OPTS => :menu_opts_color,
  BlockType::VARS => :menu_vars_color
}.freeze

### Struct.new(:state, :block)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
markdown_exec-2.4.0 lib/constants.rb