~cosmicrose/sourcehut_cli

ba07c34d0e7414a05b67b80782c090532714d483 — Rosa Richter 8 months ago dd01920
Stub out a builds subcommand
2 files changed, 22 insertions(+), 3 deletions(-)

M lib/sourcehut/cli.ex
A lib/sourcehut/cli/builds.ex
M lib/sourcehut/cli.ex => lib/sourcehut/cli.ex +11 -3
@@ 3,7 3,7 @@ defmodule Sourcehut.CLI do
  Documentation for `Sourcehut.CLI`.
  """
  alias Vapor.Provider.File
  alias Sourcehut.CLI.Todo
  alias Sourcehut.CLI.{Builds, Todo}

  def main(argv) do
    providers = [


@@ 21,11 21,11 @@ defmodule Sourcehut.CLI do
      allow_unknown_args: false,
      parse_double_dash: true,
      subcommands: [
        todo: Todo.subcommand()
        todo: Todo.subcommand(),
        builds: Builds.subcommand()
      ]
    )
    |> Optimus.parse!(argv)
    |> IO.inspect(label: "Parse results")
    |> do_command(config)
  end



@@ 37,6 37,14 @@ defmodule Sourcehut.CLI do
    Todo.do_command(args, config)
  end

  def do_command({[:builds], _opts} = args, config) do
    Builds.do_command(args, config)
  end

  def do_command({[:builds | _rest], _opts} = args, config) do
    Builds.do_command(args, config)
  end

  def do_command(_, _) do
    IO.puts("Command not recognized")
  end

A lib/sourcehut/cli/builds.ex => lib/sourcehut/cli/builds.ex +11 -0
@@ 0,0 1,11 @@
defmodule Sourcehut.CLI.Builds do
  def subcommand do
    [
      name: "builds"
    ]
  end

  def do_command(args, config) do
    IO.inspect("You're gonna get builds!")
  end
end