Class: QiitaOrg::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/qiita_org.rb

Instance Method Summary collapse

Constructor Details

#initialize(*argv) ⇒ CLI

def initialize(*argv) super(*argv) end



26
27
28
# File 'lib/qiita_org.rb', line 26

def initialize(*argv)
  super(*argv)
end

Instance Method Details

#all(*argv) ⇒ Object



126
127
128
129
130
131
# File 'lib/qiita_org.rb', line 126

def all(*argv)
  mode = argv[0] || false
  # p [argv[0], argv[1]]
  puts options[:hoge]
  QiitaAll.new(mode).run()
end

#config(*argv) ⇒ Object



98
99
100
101
102
103
104
# File 'lib/qiita_org.rb', line 98

def config(*argv)
  status = argv[0] || "local"
  option = argv[1] || nil
  input = [argv[2], argv[3], argv[4]]
  config =  QiitaConfig.new(status, option, input)
  config.run
end

#get(*argv) ⇒ Object



108
109
110
111
112
113
# File 'lib/qiita_org.rb', line 108

def get(*argv)
  p mode = argv[0] || "qiita"
  p id = argv[1] || nil
  get =  QiitaGet.new(mode, id)
  get.run
end

#list(*argv) ⇒ Object



135
136
137
138
# File 'lib/qiita_org.rb', line 135

def list(*argv)
  p mode = argv[0] || "qiita"
  QiitaList.new(mode)
end

#post(*argv) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/qiita_org.rb', line 39

def post(*argv)
  checkos = CheckPcOs.new
  os = checkos.return_os()

  if argv.size > 2
    GetMultipleFiles.new(argv, os, "post").run()
  elsif argv[-1].match(/(.+).org/) && argv.size != 1
    GetMultipleFiles.new(argv, os, "post").run()
  else
    p ["in qiita_org.rb", argv]
    p file = argv[0] || "README.org"
    p mode = argv[1] || DecideOption.new(file).decide_option()
    qiita = QiitaPost.new(file, mode, os)
    begin
      qiita.select_option(mode)
    rescue RuntimeError => e
      puts $!
    else
      qiita.run
    end
  end
end

#say_hello(*name) ⇒ Object



32
33
34
35
# File 'lib/qiita_org.rb', line 32

def say_hello(*name)
  name = name[0] || "world"
  puts "Hello #{name}."
end

#template(*argv) ⇒ Object



117
118
119
120
121
122
# File 'lib/qiita_org.rb', line 117

def template(*argv)
  checkos = CheckPcOs.new
  os = checkos.return_os()

  template = QiitaGetTemplate.new(os).run()
end

#upload(*argv) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/qiita_org.rb', line 64

def upload(*argv)
  checkos = CheckPcOs.new
  os = checkos.return_os()

  if argv.size > 2
    GetMultipleFiles.new(argv, os, "upload").run()
  elsif argv[-1].match(/(.+).org/) && argv.size != 1
    GetMultipleFiles.new(argv, os, "upload").run()
  else
    p file = argv[0] || "README.org"
    p mode = argv[1] || DecideOption.new(file).decide_option()

    qiita = QiitaUpLoad.new(file, mode, os).upload()
  end
=begin
  getpath = GetFilePath.new(file)
  paths = getpath.get_file_path()
  unless paths.empty?
    showfile = ShowFile.new(paths, file, mode, os)
    showfile.open_file_dir()
    showfile.open_qiita()

    puts "Input file URL's on #{file}? (y/n)".green
    ans = STDIN.getch

    if ans == "y"
      showfile.input_url_to_org()
    end
  end
=end
end

#versionObject



142
143
144
# File 'lib/qiita_org.rb', line 142

def version
  puts QiitaOrg::VERSION
end