Module: Fatty

Defined in:
lib/fatty.rb,
lib/fatty/api.rb,
lib/fatty/env.rb,
lib/fatty/ansi.rb,
lib/fatty/ansi.rb,
lib/fatty/help.rb,
lib/fatty/alert.rb,
lib/fatty/pager.rb,
lib/fatty/action.rb,
lib/fatty/config.rb,
lib/fatty/logger.rb,
lib/fatty/prompt.rb,
lib/fatty/screen.rb,
lib/fatty/search.rb,
lib/fatty/command.rb,
lib/fatty/counter.rb,
lib/fatty/history.rb,
lib/fatty/key_map.rb,
lib/fatty/session.rb,
lib/fatty/version.rb,
lib/fatty/api/menu.rb,
lib/fatty/progress.rb,
lib/fatty/renderer.rb,
lib/fatty/terminal.rb,
lib/fatty/viewport.rb,
lib/fatty/api/alert.rb,
lib/fatty/key_event.rb,
lib/fatty/actionable.rb,
lib/fatty/api/choose.rb,
lib/fatty/api/output.rb,
lib/fatty/api/prompt.rb,
lib/fatty/api/status.rb,
lib/fatty/api/keytest.rb,
lib/fatty/input_field.rb,
lib/fatty/mouse_event.rb,
lib/fatty/api/progress.rb,
lib/fatty/colors/color.rb,
lib/fatty/colors/pairs.rb,
lib/fatty/curses/patch.rb,
lib/fatty/input_buffer.rb,
lib/fatty/ansi/renderer.rb,
lib/fatty/core_ext/hash.rb,
lib/fatty/history/entry.rb,
lib/fatty/keymaps/emacs.rb,
lib/fatty/output_buffer.rb,
lib/fatty/themes/loader.rb,
lib/fatty/themes/themes.rb,
lib/fatty/colors/palette.rb,
lib/fatty/curses/context.rb,
lib/fatty/themes/manager.rb,
lib/fatty/api/environment.rb,
lib/fatty/core_ext/string.rb,
lib/fatty/markdown/render.rb,
lib/fatty/renderer/curses.rb,
lib/fatty/themes/registry.rb,
lib/fatty/themes/resolver.rb,
lib/fatty/log_formats/json.rb,
lib/fatty/log_formats/text.rb,
lib/fatty/action_environment.rb,
lib/fatty/curses/key_decoder.rb,
lib/fatty/renderer/truecolor.rb,
lib/fatty/curses/curses_coder.rb,
lib/fatty/curses/event_source.rb,
lib/fatty/callback_environment.rb,
lib/fatty/terminal/popup_owner.rb,
lib/fatty/curses/window_styling.rb,
lib/fatty/session/alert_session.rb,
lib/fatty/session/modal_session.rb,
lib/fatty/session/popup_session.rb,
lib/fatty/session/shell_session.rb,
lib/fatty/markdown/ansi_renderer.rb,
lib/fatty/session/output_session.rb,
lib/fatty/session/prompt_session.rb,
lib/fatty/session/search_session.rb,
lib/fatty/session/status_session.rb,
lib/fatty/session/isearch_session.rb,
lib/fatty/session/keytest_session.rb

Overview

This class provides a wrapper around components that can be handed off to Terminal's on_accept method (or other callbacks) for access to Fatty's facilities. The on_accept proc will receive two parameters: (1) the edited line and (2) an instance of this class called env from which the user can access certain facilities that Fatty provides.

For example, by using env.append("some text"), the given text will be displayed in the output pane with scrolling, search, etc. A related method, env.markdown(<markdown_text>) will render the given text as markdown and then append it to the output pane.

Using env.status will display text in the status area. Likewise with env.alert for the alert panel.

You can add a Progress object to the status_area with env.add_progress and update it with env.progress.update.

Defined Under Namespace

Modules: Actionable, Actions, AlertApi, Ansi, ChooseApi, Color, Colors, Config, CoreExt, Curses, Env, EnvironmentApi, Help, Keymaps, KeytestApi, Logger, Markdown, MenuApi, OutputApi, ProgressApi, PromptApi, Search, StatusApi, Themes Classes: ActionEnvironment, ActionError, Alert, AlertSession, AnsiRenderer, CallbackEnvironment, Command, Counter, Error, History, ISearchSession, InputBuffer, InputField, Interrupt, KeyEvent, KeyGesture, KeyMap, KeyTestSession, ModalSession, MouseEvent, MouseGesture, OutputBuffer, OutputSession, Pager, PopUpSession, Progress, Prompt, PromptSession, Renderer, Screen, SearchSession, Session, ShellSession, StatusSession, Terminal, Viewport

Constant Summary collapse

VERSION =
"0.99.3"

Class Method Summary collapse

Class Method Details

.debug(event, tag: nil, **data) ⇒ Object



128
129
130
# File 'lib/fatty/logger.rb', line 128

def self.debug(event, tag: nil, **data)
  Logger.log(event, level: :debug, tag: tag, **data)
end

.error(event, tag: nil, **data) ⇒ Object



140
141
142
# File 'lib/fatty/logger.rb', line 140

def self.error(event, tag: nil, **data)
  Logger.log(event, level: :error, tag: tag, **data)
end

.fatal(event, tag: nil, **data) ⇒ Object



144
145
146
# File 'lib/fatty/logger.rb', line 144

def self.fatal(event, tag: nil, **data)
  Logger.log(event, level: :fatal, tag: tag, **data)
end

.info(event, tag: nil, **data) ⇒ Object



132
133
134
# File 'lib/fatty/logger.rb', line 132

def self.info(event, tag: nil, **data)
  Logger.log(event, level: :info, tag: tag, **data)
end

.log(event = nil, level: :debug, tag: nil, **data) ⇒ Object

So we can just call Fatty.log



124
125
126
# File 'lib/fatty/logger.rb', line 124

def self.log(event = nil, level: :debug, tag: nil, **data)
  Logger.log(event, level: level, tag: tag, **data)
end

.warn(event, tag: nil, **data) ⇒ Object



136
137
138
# File 'lib/fatty/logger.rb', line 136

def self.warn(event, tag: nil, **data)
  Logger.log(event, level: :warn, tag: tag, **data)
end