lib/ayadn/app.rb in ayadn-0.6.4 vs lib/ayadn/app.rb in ayadn-1.0.0

- old
+ new

@@ -1,367 +1,431 @@ -#!/usr/bin/env ruby # encoding: utf-8 +module Ayadn + class App < Thor + package_name "Ayadn" -puts "\n\nAYADN".red + " - " + "App.net command-line client\n".brown + %w{action api descriptions endpoints cnx view workers settings post status extend databases fileops logs pinboard set alias errors blacklist scroll authorize switch}.each { |r| require_relative "#{r}" } -$status = AyaDN::ClientStatus.new -$tools = AyaDN::Tools.new -$files = AyaDN::Files.new -$files.makedir($tools.ayadn_configuration[:db_path]) + desc "timeline", "Show your App.net timeline, aka the Unified Stream (-tl)" + map "unified" => :timeline + map "-tl" => :timeline + long_desc Descriptions.unified + option :scroll, aliases: "-s", type: :boolean, desc: "Scroll the stream" + option :new, aliases: "-n", type: :boolean, desc: Descriptions.options_new + option :count, aliases: "-c", type: :numeric, desc: Descriptions.options_count + option :index, aliases: "-i", type: :boolean, desc: Descriptions.options_index + option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw + def timeline + Action.new.unified(options) + end -token = $files.auth_read -if token != nil - client = AyaDN.new(token) - client.configAPI -else - puts $status.errorNotAuthorized - AyaDN.new(nil).ayadnAuthorize(nil) - exit -end + desc "checkins", "Show the Checkins Stream (-ck)" + map "-ck" => :checkins + long_desc Descriptions.checkins + option :scroll, aliases: "-s", type: :boolean, desc: "Scroll the stream" + option :new, aliases: "-n", type: :boolean, desc: Descriptions.options_new + option :count, aliases: "-c", type: :numeric, desc: Descriptions.options_count + option :index, aliases: "-i", type: :boolean, desc: Descriptions.options_index + option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw + def checkins + Action.new.checkins(options) + end -arg1, arg2, arg3, arg4 = ARGV[0], ARGV[1], ARGV[2], ARGV[3] + desc "global", "Show the Global Stream (-gl)" + map "-gl" => :global + long_desc Descriptions.global + option :scroll, aliases: "-s", type: :boolean, desc: "Scroll the stream" + option :new, aliases: "-n", type: :boolean, desc: Descriptions.options_new + option :count, aliases: "-c", type: :numeric, desc: Descriptions.options_count + option :index, aliases: "-i", type: :boolean, desc: Descriptions.options_index + option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw + def global + Action.new.global(options) + end -case arg1 + desc "trending", "Show the Trending Stream (-tr)" + map "-tr" => :trending + long_desc Descriptions.trending + option :scroll, aliases: "-s", type: :boolean, desc: "Scroll the stream" + option :new, aliases: "-n", type: :boolean, desc: Descriptions.options_new + option :count, aliases: "-c", type: :numeric, desc: Descriptions.options_count + option :index, aliases: "-i", type: :boolean, desc: Descriptions.options_index + option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw + def trending + Action.new.trending(options) + end -when "scroll" - client.ayadnScroll(arg2, arg3) + # desc "photos", "Show the Photos Stream (-ph)" + # map "-ph" => :photos + # long_desc Descriptions.photos + # option :scroll, aliases: "-s", type: :boolean, desc: "Scroll the stream" + # option :new, aliases: "-n", type: :boolean, desc: Descriptions.options_new + # option :count, aliases: "-c", type: :numeric, desc: Descriptions.options_count + # option :index, aliases: "-i", type: :boolean, desc: Descriptions.options_index + # option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw + # def photos + # Action.new.photos(options) + # end -when nil - client.ayadnUnified(nil) + desc "conversations", "Show the Conversations Stream (-cq)" + map "-cq" => :conversations + long_desc Descriptions.conversations + option :scroll, aliases: "-s", type: :boolean, desc: "Scroll the stream" + option :new, aliases: "-n", type: :boolean, desc: Descriptions.options_new + option :count, aliases: "-c", type: :numeric, desc: Descriptions.options_count + option :index, aliases: "-i", type: :boolean, desc: Descriptions.options_index + option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw + def conversations + Action.new.conversations(options) + end -when "unified", "uni" - client.ayadnUnified(arg2) + desc "mentions @USERNAME", "Show posts containing a mention of @username (-m)" + map "-m" => :mentions + long_desc Descriptions.mentions + option :scroll, aliases: "-s", type: :boolean, desc: "Scroll the stream" + option :count, aliases: "-c", type: :numeric, desc: Descriptions.options_count + option :index, aliases: "-i", type: :boolean, desc: Descriptions.options_index + option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw + def mentions(*username) + Action.new.mentions(username, options) + end -when "write", "w" - arg2 != nil ? client.ayadnSendPost(arg2, nil) : client.ayadn_compose_post + desc "userposts @USERNAME", "Show posts by @username (-up)" + map "-up" => :userposts + long_desc Descriptions.posts + option :scroll, aliases: "-s", type: :boolean, desc: "Scroll the stream" + option :count, aliases: "-c", type: :numeric, desc: Descriptions.options_count + option :index, aliases: "-i", type: :boolean, desc: Descriptions.options_index + option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw + def userposts(*username) + Action.new.posts(username, options) + end -when "reply", "r" - if arg2 != nil - arg2.is_integer? ? client.ayadn_reply(arg2) : (puts $status.errorPostID(arg2)) - else - puts $status.errorNoID - end + desc "interactions", "Show your recent ADN activity (-int)" + map "-int" => :interactions + long_desc Descriptions.interactions + option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw + def interactions + Action.new.interactions(options) + end -when "global", "g" - client.ayadnGlobal(arg2) + desc "whatstarred @USERNAME", "Show posts starred by @username (-was)" + map "-was" => :whatstarred + long_desc Descriptions.whatstarred + option :count, aliases: "-c", type: :numeric, desc: Descriptions.options_count + option :index, aliases: "-i", type: :boolean, desc: Descriptions.options_index + option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw + def whatstarred(*username) + Action.new.whatstarred(username, options) + end -when "mentions", "m" - (arg2 =~ /^@/ || arg2 == "me") ? client.ayadnUserMentions(arg2, arg3) : (puts $status.errorUserID(arg2)) + desc "whoreposted POST", "List users who reposted a post (-wor)" + map "-wor" => :whoreposted + long_desc Descriptions.whoreposted + option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw + def whoreposted(post_id) + Action.new.whoreposted(post_id, options) + end -when "posts", "p" - (arg2 =~ /^@/ || arg2 == "me") ? client.ayadnUserPosts(arg2, arg3) : (puts $status.errorUserID(arg2)) + desc "whostarred POST", "List users who starred a post (-wos)" + map "-wos" => :whostarred + long_desc Descriptions.whostarred + option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw + def whostarred(post_id) + Action.new.whostarred(post_id, options) + end -when "trending", "conversations", "checkins", "photos" - client.ayadnExplore(arg1, arg2) + desc "convo POST", "Show the conversation thread around a post (-co)" + map "-co" => :convo + map "thread" => :convo + option :scroll, aliases: "-s", type: :boolean, desc: "Scroll the stream" + option :index, aliases: "-i", type: :boolean, desc: Descriptions.options_index + option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw + long_desc Descriptions.convo + def convo(post_id) + Action.new.convo(post_id, options) + end -when "infos", "i", "info" - if arg2 =~ /^@/ || arg2 == "me" - client.ayadnUserInfos(arg2) - elsif arg2.is_integer? - client.ayadnPostInfos(arg2) - else - puts $status.errorInfos(arg2) - end + desc "followings @USERNAME", "List users @username is following (-fwg)" + map "-fwg" => :followings + long_desc Descriptions.followings + option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw + def followings(*username) + Action.new.followings(username, options) + end -when "convo", "c", "thread" - arg2.is_integer? ? client.ayadnConversation(arg2) : (puts $status.errorPostID(arg2)) + desc "followers @USERNAME", "List users following @username (-fwr)" + map "-fwr" => :followers + long_desc Descriptions.followers + option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw + def followers(*username) + Action.new.followers(username, options) + end -when "tag", "t", "hashtag" - theTag = arg2.dup - theTag[0] = "" if theTag =~ /^#/ - client.ayadnHashtags(theTag) + desc "muted", "List the users you muted (-mtd)" + map "-mtd" => :muted + long_desc Descriptions.muted + option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw + def muted + Action.new.muted(options) + end -when "delete" - if arg2.is_integer? - puts "\nAre you sure you want to delete post ".green + "#{arg2}? ".brown + "(n/y) ".green - input = STDIN.getch - (input == "y" || input == "Y") ? client.ayadnDeletePost(arg2) : (puts "\nCanceled.\n\n".red) - else - puts $status.errorPostID(arg2) - end + desc "blocked", "List the users you blocked (-bkd)" + map "-bkd" => :blocked + long_desc Descriptions.blocked + option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw + def blocked + Action.new.blocked(options) + end -when "list" - case arg2 - when "followings", "fwings" - (arg3 =~ /^@/ || arg3 == "me") ? client.ayadnShowList("followings", arg3) : (puts $status.errorSyntax) - when "followers", "fwers" - (arg3 =~ /^@/ || arg3 == "me") ? client.ayadnShowList("followers", arg3) : (puts $status.errorSyntax) - when "muted" - client.ayadnShowList("muted", "me") - when "blocked" - client.ayadnShowList("blocked", "me") - when "files" - client.ayadn_list_files(arg3) - when "options","config" - client.ayadn_show_options - when "channels", "ch" - client.get_loaded_channels - client.ayadn_get_channels - when "aliases", "alias", "channel-alias", "alias-channel" - client.ayadn_list_aliases - else - puts $status.errorSyntax - end + desc "hashtag HASHTAG", "Show recent posts containing #HASHTAG (-t)" + map "-t" => :hashtag + long_desc Descriptions.hashtag + option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw + def hashtag(hashtag) + Action.new.hashtag(hashtag, options) + end -when "star" - arg2.is_integer? ? client.ayadnStarringPost("star", arg2) : (puts $status.errorPostID(arg2)) + desc "search WORD(S)", "Show recents posts containing WORD(S) (-s)" + map "-s" => :search + long_desc Descriptions.search + option :count, aliases: "-c", type: :numeric, desc: Descriptions.options_count + option :index, aliases: "-i", type: :boolean, desc: Descriptions.options_index + option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw + def search(*words) + Action.new.search(words.join(","), options) + end -when "unstar" - arg2.is_integer? ? client.ayadnStarringPost("unstar", arg2) : (puts $status.errorPostID(arg2)) + desc "settings", "List current Ayadn settings (-sg)" + map "-sg" => :settings + long_desc Descriptions.settings + def settings + Action.new.view_settings + end -when "repost" - arg2.is_integer? ? client.ayadnReposting("repost", arg2) : (puts $status.errorPostID(arg2)) + desc "userinfo @USERNAME", "Show detailed informations about @username (-ui)" + map "-ui" => :userinfo + long_desc Descriptions.userinfo + option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw + def userinfo(*username) + Action.new.userinfo(username, options) + end -when "unrepost" - arg2.is_integer? ? client.ayadnReposting("unrepost", arg2) : (puts $status.errorPostID(arg2)) + desc "postinfo POST", "Show detailed informations about a post (-pi)" + map "-pi" => :postinfo + long_desc Descriptions.postinfo + option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw + def postinfo(post_id) + Action.new.postinfo(post_id, options) + end -when "follow" - arg2 =~ /^@/ ? client.ayadnFollowing("follow", arg2) : (puts $status.errorUserID(arg2)) + desc "files", "List your files (-fl)" + map "-fl" => :files + long_desc Descriptions.files + option :count, aliases: "-c", type: :numeric, desc: "Specify the number of files to display" + option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw + option :all, aliases: "-a", type: :boolean, desc: "Retrieve the list of all your files" + def files + Action.new.files(options) + end -when "unfollow" - arg2 =~ /^@/ ? client.ayadnFollowing("unfollow", arg2) : (puts $status.errorUserID(arg2)) + desc "delete POST", "Delete a post (-D)" + map "-D" => :delete + long_desc Descriptions.delete + def delete(post_id) + Action.new.delete(post_id) + end -when "pm" - if arg2 =~ /^@/ - if arg3 != nil - # ayadn pm @ericd "hello!" - client.ayadnSendMessage(arg2, arg3) - else - client.ayadnComposeMessage(arg2) - end - else - puts $status.errorSyntax - end + desc "unfollow @USERNAME", "Unfollow @username (-UF)" + map "-UF" => :unfollow + long_desc Descriptions.unfollow + def unfollow(*username) + Action.new.unfollow(username) + end -when "send" - if arg3 != nil - # ayadn send 12345 "hello, channel!" - client.ayadnSendMessageToChannel(arg2, arg3) - else - client.ayadnComposeMessageToChannel(arg2) - end + desc "unmute @USERNAME", "Unmute @username (-UM)" + map "-UM" => :unmute + long_desc Descriptions.unmute + def unmute(*username) + Action.new.unmute(username) + end -when "channels", "ch" - client.get_loaded_channels - client.ayadn_get_channels + desc "unblock @USERNAME", "Unblock @username (-UB)" + map "-UB" => :unblock + long_desc Descriptions.unblock + def unblock(*username) + Action.new.unblock(username) + end -when "messages", "msg" - # arg2 is integer -> display channel stream - # arg3 == nil = with pagination, arg3 == "all" = no pagination - client.ayadnGetMessages(arg2, arg3) + desc "unrepost POST", "Unrepost a post (-UR)" + map "-UR" => :unrepost + long_desc Descriptions.unrepost + def unrepost(post_id) + Action.new.unrepost(post_id) + end -when "quote", "comment", "q" - if arg2.is_integer? - client.ayadn_quote(arg2) - else - puts $status.errorSyntax - end + desc "unstar POST", "Unstar a post (-US)" + map "-US" => :unstar + long_desc Descriptions.unstar + def unstar(post_id) + Action.new.unstar(post_id) + end -when "nowplaying", "itunes", "np" - client.ayadn_nowplaying + desc "star POST", "Star a post (-ST)" + map "-ST" => :star + long_desc Descriptions.star + def star(post_id) + Action.new.star(post_id) + end -when "search", "s" - arg2 != nil ? client.ayadnSearch(arg2) : (puts $status.errorSyntax) + desc "repost POST", "Repost a post (-O)" + map "-O" => :repost + long_desc Descriptions.repost + def repost(post_id) + Action.new.repost(post_id) + end -when "starred" - if arg2 =~ /^@/ || arg2 == "me" - client.ayadnStarredPosts(arg2, arg3) - elsif arg2.is_integer? - client.ayadnWhoStarred(arg2) - else - puts $status.errorUserID(arg2) - end + desc "follow @USERNAME", "Follow @username (-FO)" + map "-FO" => :follow + long_desc Descriptions.follow + def follow(*username) + Action.new.follow(username) + end -when "reposted" - arg2.is_integer? ? client.ayadnWhoReposted(arg2) : (puts $status.errorPostID(arg2)) + desc "mute @USERNAME", "Mute @username (-MU)" + map "-MU" => :mute + long_desc Descriptions.mute + def mute(*username) + Action.new.mute(username) + end -when "inter", "interactions", "events" - client.ayadnInteractions + desc "block @USERNAME", "Block @username (-BL)" + map "-BL" => :block + long_desc Descriptions.block + def block(*username) + Action.new.block(username) + end -when "save" - arg2.is_integer? ? client.ayadnSavePost(arg2) : (puts $status.errorPostID(arg2)) + desc "channels", "List your active channels (-ch)" + map "-ch" => :channels + long_desc Descriptions.channels + def channels + Action.new.channels + end -when "load" - arg2.is_integer? ? client.ayadnLoadPost(arg2) : (puts $status.errorPostID(arg2)) + desc "messages CHANNEL", "Show messages in a CHANNEL (-ms)" + map "-ms" => :messages + long_desc Descriptions.messages + option :scroll, aliases: "-s", type: :boolean, desc: "Scroll the stream" + option :new, aliases: "-n", type: :boolean, desc: Descriptions.options_new + option :count, aliases: "-c", type: :numeric, desc: "Specify the number of messages to retrieve" + option :raw, aliases: "-x", type: :boolean, desc: Descriptions.options_raw + def messages(channel_id) + Action.new.messages(channel_id, options) + end -when "backup" - if arg2 == "followings" - (arg3 =~ /^@/ || arg3 == "me") ? client.ayadnSaveList("followings", arg3) : (puts $status.errorSyntax) - elsif arg2 == "followers" - (arg3 =~ /^@/ || arg3 == "me") ? client.ayadnSaveList("followers", arg3) : (puts $status.errorSyntax) - elsif arg2 == "muted" - client.ayadnSaveList("muted", "me") - end + desc "pin POST TAG(S)", "Export a post's link and text with tags to Pinboard" + long_desc Descriptions.pin + def pin(post_id, *tags) + Action.new.pin(post_id, tags) + end -when "help", "h" - puts $tools.helpScreen + desc "post Your text", "Simple post to App.net (-P)" + map "-P" => :post + long_desc Descriptions.post + def post(*args) + Action.new.post(args) + end -when "commands", "usage" - puts $tools.list_of_commands + desc "write", "Multi-line post to App.net (-W)" + map "compose" => :write + map "-W" => :write + long_desc Descriptions.write + def write + Action.new.write + end -when "webhelp" - puts $tools.helpScreen - begin - if $tools.ayadn_configuration[:platform] =~ /darwin/ - $tools.startBrowser("https://github.com/ericdke/ayadn#ayadn") - else - puts "\nCan't start a browser automatically. Please visit ".cyan + "https://github.com/ericdke/ayadn#ayadn".magenta - end - end + desc "pm @USERNAME", "Send a private message to @username" + long_desc Descriptions.pmess + def pm(*username) + Action.new.pmess(username) + end -when "options" - client.ayadn_show_options + desc "send CHANNEL", "Send a message to a CHANNEL (-C)" + map "-C" => :send_to_channel + long_desc Descriptions.send_to_channel + def send_to_channel(channel_id) + Action.new.send_to_channel(channel_id) + end -when "debug" - if arg2 == nil - client.ayadnDebugStream - elsif arg2 =~ /^@/ - client.ayadnDebugUser(arg2) - elsif arg3.is_integer? - if arg2 == "post" - client.ayadnDebugPost(arg3) - elsif arg2 == "message" - # channel_id, message_id - client.ayadnDebugMessage(arg3, arg4) - elsif arg2 == "channel" - client.ayadnDebugChannel(arg3) - end - end + desc "reply POST", "Reply to post nĀ°POST (-R)" + map "-R" => :reply + long_desc Descriptions.reply + def reply(id) + ayadn = Action.new + ayadn.reply(id) + end -when "skip-source", "skip-client" - case arg2 - when "add" - client.ayadn_skip_add("sources", arg3) - when "remove" - client.ayadn_skip_remove("sources", arg3) - when "show" - client.ayadn_show_options - else - puts $status.errorSyntax - end + desc "auto", "Auto post every line of input to App.net" + long_desc Descriptions.auto + def auto + Action.new.auto(options) + end -when "skip-tag", "skip-hashtag" - case arg2 - when "add" - client.ayadn_skip_add("hashtags", arg3) - when "remove" - client.ayadn_skip_remove("hashtags", arg3) - when "show" - client.ayadn_show_options - else - puts $status.errorSyntax - end + desc "set TYPE PARAM VALUE", "Set/configure a parameter and save it" + long_desc Descriptions.set + subcommand "set", Set -when "skip-mention", "skip-name", "skip-username" - case arg2 - when "add" - client.ayadn_skip_add("mentions", arg3) - when "remove" - client.ayadn_skip_remove("mentions", arg3) - when "show" - client.ayadn_show_options - else - puts $status.errorSyntax - end + desc "alias COMMAND (PARAM)", "Create/delete/list aliases for channels (-A)" + map "-A" => :alias + long_desc Descriptions.alias + subcommand "alias", Alias -when "mute" - arg2 =~ /^@/ ? client.ayadnMuting("mute", arg2) : (puts $status.errorUserID(arg2)) + desc "download FILE", "Download the file with id FILE (-df)" + map "-df" => :download + long_desc Descriptions.download + def download(file_id) + ayadn = Action.new + ayadn.download(file_id) + end -when "unmute" - arg2 =~ /^@/ ? client.ayadnMuting("unmute", arg2) : (puts $status.errorUserID(arg2)) + desc "blacklist COMMAND (PARAM)", "Manage your blacklist (-K)" + map "-K" => :blacklist + long_desc Descriptions.blacklist + subcommand "blacklist", Blacklist -when "block" - arg2 =~ /^@/ ? client.ayadnBlocking("block", arg2) : (puts $status.errorUserID(arg2)) + desc "nowplaying", "Post the current iTunes track (-np)" + map "-np" => :nowplaying + long_desc Descriptions.nowplaying + def nowplaying + Action.new.nowplaying + end -when "unblock" - arg2 =~ /^@/ ? client.ayadnBlocking("unblock", arg2) : (puts $status.errorUserID(arg2)) + desc "random", "Show random posts from App.net (-rnd)" + map "-rnd" => :random + option :wait, aliases: "-w", type: :numeric, desc: "In seconds, time to wait before next page" + long_desc Descriptions.random_posts + def random + Action.new.random_posts(options) + end -when "reset" - if arg2 == "pagination" - client.ayadnReset(arg3, arg4) - elsif arg2 == nil - client.ayadnReset(nil, nil) - end + desc "authorize", "Authorize Ayadn (-auth)" + map "-auth" => :authorize + long_desc Descriptions.authorize + def authorize + Authorize.new.authorize + end -# when "deactivate" -# # deactivate a user channel -# client.ayadnDeactivateChannel(arg2) + desc "switch @USERNAME", "Switch between authorized App.net accounts (-@)" + map "-@" => :switch + option :list, aliases: "-l", type: :boolean, desc: "List authorized accounts" + long_desc Descriptions.switch + def switch(*username) + unless options[:list] + Switch.new.switch(username) + else + Switch.new.list + end + end -when "random" - # just for fun, a quick & dirty hack :) - api = AyaDN::API.new(token) - puts "Fetching random posts, wait a second... (quit with CTRL+C)\n\n".green - $tools.config['counts']['global'] = 20 - hash = api.getGlobal(2) - puts "\e[H\e[2J" - last_post = hash['data'][0]['id'].to_i - rnd_post_num = rand(last_post + 1) - hash = api.getSinglePost(rnd_post_num) - hash = hash['data'] - puts AyaDN::View.new(nil).buildSimplePost(hash) - if hash['text'] == nil - puts "\n-- SKIPPED POST (NO TEXT) --\n\n" - sleep 0.2 - end - loop do - begin - sleep 0.7 - rnd_post_num = rand(last_post + 1) - hash = api.getSinglePost(rnd_post_num) - hash = hash['data'] - if hash['text'] == nil - puts "\n-- SKIPPED POST (NO TEXT) --\n\n" - sleep 0.2 - next - end - #jj hash['annotations'] if hash['annotations'] - puts AyaDN::View.new(nil).buildSimplePost(hash) - rescue Exception => e - #puts e.inspect - abort($status.stopped) - end - end - -when "delete-message" - client.ayadn_delete_message(arg2, arg3) #channel, message - -when "download" - client.ayadn_download_files(arg2) - -when "delete-file" - client.ayadn_delete_file(arg2) - -when "upload" - client.ayadn_upload_files(arg2) - -when "private", "public" - client.ayadn_attribute_file(arg1, arg2) - -when "pin" - client.ayadnBookmark(ARGV) - -when "alias-channel" - client.ayadn_alias_channel(arg2, arg3) - -when "stream_global" - client.ayadn_userstream - -when "does", "do", "is", "has" - client.ayadn_does(ARGV) - -when "authorize", "login" - AyaDN.new(nil).ayadnAuthorize("reset") - -when "install" - if arg2 == "config" - $tools.installConfig - else - puts $status.errorSyntax - end - -else - # if not any known argument - puts $status.errorSyntax - puts "#{ARGV.join(" ")} ".brown + "is not a valid option.\n\n".red - puts $tools.helpScreen - -end \ No newline at end of file + end +end