{"action":"created","issue":{"url":"https://api.github.com/repos/ruby-gnome2/ruby-gnome2/issues/582","labels_url":"https://api.github.com/repos/ruby-gnome2/ruby-gnome2/issues/582/labels{/name}","comments_url":"https://api.github.com/repos/ruby-gnome2/ruby-gnome2/issues/582/comments","events_url":"https://api.github.com/repos/ruby-gnome2/ruby-gnome2/issues/582/events","html_url":"https://github.com/ruby-gnome2/ruby-gnome2/issues/582","id":108520257,"number":582,"title":"How to deal with GVariantDict","user":{"login":"cedlemo","id":1135841,"avatar_url":"https://avatars.githubusercontent.com/u/1135841?v=3","gravatar_id":"","url":"https://api.github.com/users/cedlemo","html_url":"https://github.com/cedlemo","followers_url":"https://api.github.com/users/cedlemo/followers","following_url":"https://api.github.com/users/cedlemo/following{/other_user}","gists_url":"https://api.github.com/users/cedlemo/gists{/gist_id}","starred_url":"https://api.github.com/users/cedlemo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cedlemo/subscriptions","organizations_url":"https://api.github.com/users/cedlemo/orgs","repos_url":"https://api.github.com/users/cedlemo/repos","events_url":"https://api.github.com/users/cedlemo/events{/privacy}","received_events_url":"https://api.github.com/users/cedlemo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-27T07:48:13Z","updated_at":"2015-09-27T09:27:16Z","closed_at":null,"body":"Here is the code:\r\n\r\n```ruby\r\nrequire \"gtk3\"\r\n\r\nclass Demo < Gtk::Application\r\n  def initialize\r\n    super(\"org.gtk.Demo\", [:non_unique, :handles_command_line])\r\n\r\n    signal_connect \"startup\" do |application|\r\n      puts \"startup\"\r\n    end\r\n\r\n    signal_connect \"activate\" do |application|\r\n      puts \"activate\"\r\n    end\r\n\r\n    signal_connect \"command-line\" do |application, command_line|\r\n      puts \"cmd\"\r\n      options = command_line.options_dict\r\n      puts options.inspect\r\n      puts options.methods\r\n      name = options.lookup(\"run\", \"&s\")\r\n      autoquit = options.lookup(\"autoquit\", \"b\")\r\n      list = options.lookup(\"list\", \"b\")\r\n      1\r\n    end\r\n  end\r\nend\r\n\r\ndemo = Demo.new\r\n\r\ndemo.run([$PROGRAM_NAME] + ARGV)\r\n```\r\n\r\nThe options variable that I get with `command_line.options_dict` should be the ruby implementation of the `GVariantDict` from glib but it doesn't seem to be well implemented."},"comment":{"url":"https://api.github.com/repos/ruby-gnome2/ruby-gnome2/issues/comments/143532944","html_url":"https://github.com/ruby-gnome2/ruby-gnome2/issues/582#issuecomment-143532944","issue_url":"https://api.github.com/repos/ruby-gnome2/ruby-gnome2/issues/582","id":143532944,"user":{"login":"kou","id":27350,"avatar_url":"https://avatars.githubusercontent.com/u/27350?v=3","gravatar_id":"","url":"https://api.github.com/users/kou","html_url":"https://github.com/kou","followers_url":"https://api.github.com/users/kou/followers","following_url":"https://api.github.com/users/kou/following{/other_user}","gists_url":"https://api.github.com/users/kou/gists{/gist_id}","starred_url":"https://api.github.com/users/kou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kou/subscriptions","organizations_url":"https://api.github.com/users/kou/orgs","repos_url":"https://api.github.com/users/kou/repos","events_url":"https://api.github.com/users/kou/events{/privacy}","received_events_url":"https://api.github.com/users/kou/received_events","type":"User","site_admin":false},"created_at":"2015-09-27T09:27:16Z","updated_at":"2015-09-27T09:27:16Z","body":"Could you use`command_line.arguments` and [OptionParser](http://docs.ruby-lang.org/en/2.2.0/OptionParser.html) instead of `options_dict`?\r\n\r\nBecause we don't have a plan to support `g_application_add_main_option()`. Parsing command line option in Ruby is convenience and Rubyish."}}