Skip to content

Commit

Permalink
rework manual
Browse files Browse the repository at this point in the history
  • Loading branch information
Ifiht committed Feb 11, 2024
1 parent 086bdd4 commit e1efe67
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/manual.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,25 @@
require_relative "lib/app_settings"

# Get user settings
skgram = ShikiGram.new
core_config = AppSettings.new
beanstalk_host = core_config.get("beanstalk_host")
beanstalk_port = core_config.get("beanstalk_port")

# Connect to beanstalkd
beanstalk = Beaneater.new("#{beanstalk_host}\:#{beanstalk_port}")
args = ARGV
tube = ARGV[0]
alltubes = beanstalk.tubes.all
puts alltubes.inspect
if args.length != 2
tube = beanstalk.tubes[ARGV[0]]
arg = ARGV[1]
skg = ShikiGram.new
msg = skg.wrap_msg(arg)
tube.put msg
puts "this script requires two arguments."
elsif not alltubes.include? tube
puts "tube #{tube} does not exist."
else
bean = beanstalk.tubes[ARGV[0]]
arg = ARGV[1]
msg = skgram.wrap_msg(arg)
bean.put msg
end
beanstalk.close

0 comments on commit e1efe67

Please sign in to comment.