#!/usr/bin/env escript
%% -*- erlang -*-
%%! debug verbose -noshell -pa ebin

main([Command|_Args]) ->
    case Command of
      "h2r" ->
        [Object|_Rest] = _Args,
        Raw = geef:hex_to_raw(Object),
        io:format("Raw: ~w~n", [Raw]);
      "exists" ->
        [Path|_Rest] = _Args,
        [Object|_None] = _Rest,
        Exists = geef:object_exists(Path, Object),
        io:format("Exists: ~w~n", [Exists]);
      "repo-path" ->
	[Path|_Rest] = _Args,
	Repo = geef:repository(Path),
	io:format("Repository path: ~s~n", [geef:repository_path(Repo)]);
      _Else ->
        usage()
    end;
main(_) ->
    usage().
        
usage() ->
    io:format("usage: ./geef h2r HEX_SHA\n"),
    halt(1).
        
