diff --git a/exe/referator b/exe/referator index f99c522..2552cf8 100755 --- a/exe/referator +++ b/exe/referator @@ -37,6 +37,9 @@ while (line = $stdin.gets) begin command, rest = parse_command line case command + ################## + # Administrative # + ################## when 'EXIT' success exit @@ -45,6 +48,13 @@ while (line = $stdin.gets) when 'STACKTRACE' success stacktrace stacktrace = nil + ########## + # Config # + ########## + when 'REGISTER_CATEGORY' + data = JSON.parse rest + config.categories.register String(data).to_sym + success when 'REGISTER_FORMAT' data = JSON.parse rest config.formats.register( @@ -52,21 +62,13 @@ while (line = $stdin.gets) **data.except('name').transform_keys(&:to_sym), ) success - when 'REGISTER_CATEGORY' - data = JSON.parse rest - config.categories.register String(data).to_sym - success when 'REGISTER_REF' data = JSON.parse rest config.repo.register_ref(**data.transform_keys(&:to_sym)) success - when 'MAKE_REF' - config.freeze - data = JSON.parse rest - success footnotes.make_ref( - String(data['category']).to_sym, - String(data['id']), - ).to_h + ######## + # Info # + ######## when 'REF' config.freeze data = JSON.parse rest @@ -74,6 +76,19 @@ while (line = $stdin.gets) String(data['category']).to_sym, String(data['id']), ].to_h + ############ + # Creation # + ############ + when 'MAKE_REF' + config.freeze + data = JSON.parse rest + success footnotes.make_ref( + String(data['category']).to_sym, + String(data['id']), + ).to_h + ############# + # Rendering # + ############# when 'FETCH_NOTE' config.freeze data = JSON.parse rest