Compare commits
4 commits
develop
...
feature/24
Author | SHA1 | Date | |
---|---|---|---|
0fce436cee | |||
c66534d889 | |||
96f5521286 | |||
582282e525 |
4 changed files with 95 additions and 0 deletions
|
@ -19,6 +19,7 @@ steps:
|
|||
# cmake g++ \
|
||||
# libevent-dev libpcre3-dev \
|
||||
# libyaml-dev liblzma-dev
|
||||
- apk --update add unibilium-dev
|
||||
- shards install
|
||||
- shards build --production --static
|
||||
- strip bin/mfm
|
||||
|
|
24
shard.lock
24
shard.lock
|
@ -4,10 +4,34 @@ shards:
|
|||
git: https://github.com/straight-shoota/crinja.git
|
||||
version: 0.8.1
|
||||
|
||||
crystallabs-helpers:
|
||||
git: https://github.com/crystallabs/crystallabs-helpers.cr.git
|
||||
version: 1.0.1
|
||||
|
||||
ioctl:
|
||||
git: https://github.com/crystal-posix/ioctl.cr.git
|
||||
version: 1.0.0
|
||||
|
||||
shellwords:
|
||||
git: https://github.com/sztheory/shellwords-crystal.git
|
||||
version: 0.1.0
|
||||
|
||||
term-screen:
|
||||
git: https://github.com/crystal-term/screen.git
|
||||
version: 0.1.0+git.commit.ea51ee8d1f6c286573c41a7e784d31c80af7b9bb
|
||||
|
||||
tput:
|
||||
git: https://github.com/crystallabs/tput.cr.git
|
||||
version: 1.0.7
|
||||
|
||||
unibilium:
|
||||
git: https://github.com/crystallabs/unibilium.cr.git
|
||||
version: 1.0.1
|
||||
|
||||
unibilium-shim:
|
||||
git: https://github.com/crystallabs/unibilium-shim.cr.git
|
||||
version: 1.1.0
|
||||
|
||||
version_from_shard:
|
||||
git: https://github.com/hugopl/version_from_shard.git
|
||||
version: 1.2.5
|
||||
|
|
|
@ -8,6 +8,8 @@ name: Minimalist FUSE Manager
|
|||
version: 0.1.11
|
||||
|
||||
targets:
|
||||
test:
|
||||
main: src/test.cr
|
||||
mfm:
|
||||
main: src/main.cr
|
||||
|
||||
|
@ -24,6 +26,9 @@ dependencies:
|
|||
github: szTheory/shellwords-crystal
|
||||
version_from_shard:
|
||||
github: hugopl/version_from_shard
|
||||
tput:
|
||||
github: crystallabs/tput.cr
|
||||
version: ~> 1.0
|
||||
|
||||
# dependencies:
|
||||
# pg:
|
||||
|
|
65
src/test.cr
Normal file
65
src/test.cr
Normal file
|
@ -0,0 +1,65 @@
|
|||
require "unibilium"
|
||||
require "tput"
|
||||
|
||||
terminfo = Unibilium::Terminfo.from_env
|
||||
tput = Tput.new terminfo
|
||||
|
||||
# Print detected features and environment
|
||||
p tput.features.to_json
|
||||
p tput.emulator.to_json
|
||||
|
||||
# Set terminal emulator's title, if possible
|
||||
tput.title = "Test 123"
|
||||
|
||||
# Set cursor to red block:
|
||||
tput.cursor_shape Tput::CursorShape::Block, blink: false
|
||||
tput.cursor_color Tput::Color::Red
|
||||
|
||||
# Switch to "alternate buffer", print some text
|
||||
tput.alternate
|
||||
tput.cursor_pos 10, 20
|
||||
tput.echo "Text at position y=10, x=20"
|
||||
tput.bell
|
||||
tput.cr
|
||||
tput.lf
|
||||
|
||||
tput.echo "Now displaying ACS chars:"
|
||||
tput.cr
|
||||
tput.lf
|
||||
tput.smacs
|
||||
tput.echo "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"
|
||||
tput.rmacs
|
||||
|
||||
tput.cr
|
||||
tput.lf
|
||||
tput.echo "Press any keys; q to exit."
|
||||
|
||||
# Listen for keypresses:
|
||||
tput.listen do |char, key, sequence|
|
||||
# Char is a single typed character, or the first character
|
||||
# of a sequence which led to a particular key.
|
||||
|
||||
# Key is a keyboard key, if any. Ordinary characters like
|
||||
# 'a' or '1' don't have a representation as Key. Special
|
||||
# keys like Enter, F1, Esc etc. do.
|
||||
|
||||
# Sequence is the complete sequence of characters which
|
||||
# were consumed as part of identifying the key that was
|
||||
# pressed.
|
||||
if char == 'q'
|
||||
# tput.normal_buffer
|
||||
# tput.reset_cursor
|
||||
# tput.exit_alt_charset_mode
|
||||
# tput.attr("normal", 1)
|
||||
# tput.soft_reset
|
||||
# system("stty echo")
|
||||
break
|
||||
else
|
||||
tput.cr
|
||||
tput.lf
|
||||
tput.echo "Char=#{char.inspect}, Key=#{key.inspect}, Sequence=#{sequence.inspect}"
|
||||
end
|
||||
end
|
||||
|
||||
tput.normal_buffer
|
||||
# tput.clear
|
Loading…
Reference in a new issue