-module(entwine_ffi). -export([open_browser/1, prompt/1, now_rfc3339/0]). prompt(Message) -> case io:get_line(Message) of eof -> <<>>; {error, _} -> <<>>; Line -> unicode:characters_to_binary(string:trim(Line)) end. open_browser(Url) -> Command = case os:type() of {unix, darwin} -> "open"; _ -> "xdg-open" end, case os:find_executable(Command) of false -> nil; Executable -> _ = open_port( {spawn_executable, Executable}, [binary, {args, [Url]}] ), nil end. now_rfc3339() -> unicode:characters_to_binary( calendar:system_time_to_rfc3339( erlang:system_time(millisecond), [{unit, millisecond}, {offset, 0}] ) ).