-module(sketch_css@commands@generate). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -define(FILEPATH, "src/sketch_css/commands/generate.gleam"). -export([css/0]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. ?MODULEDOC(false). -file("src/sketch_css/commands/generate.gleam", 40). ?DOC(false). -spec dst_flag() -> glint:flag(binary()). dst_flag() -> Msg = <<"Define the directory in which styles should be output."/utf8>>, _pipe = glint:string_flag(<<"dest"/utf8>>), glint:flag_help(_pipe, Msg). -file("src/sketch_css/commands/generate.gleam", 46). ?DOC(false). -spec src_flag() -> glint:flag(binary()). src_flag() -> Msg = <<"Define the directory in which styles should be read."/utf8>>, _pipe = glint:string_flag(<<"src"/utf8>>), glint:flag_help(_pipe, Msg). -file("src/sketch_css/commands/generate.gleam", 52). ?DOC(false). -spec interface_flag() -> glint:flag(binary()). interface_flag() -> Msg = <<"Define the directory in which interfaces should be output."/utf8>>, _pipe = glint:string_flag(<<"interface"/utf8>>), glint:flag_help(_pipe, Msg). -file("src/sketch_css/commands/generate.gleam", 28). ?DOC(false). -spec run_glint( fun((gleam@option:option(binary()), gleam@option:option(binary()), gleam@option:option(binary())) -> nil) ) -> glint:command(nil). run_glint(Continuation) -> glint:command_help( <<"Generate CSS for your gleam_styles.gleam files!"/utf8>>, fun() -> glint:flag( dst_flag(), fun(Dst) -> glint:flag( src_flag(), fun(Src) -> glint:flag( interface_flag(), fun(Interface) -> glint:command( fun(_, _, Flags) -> Dst@1 = begin _pipe = Dst(Flags), gleam@option:from_result(_pipe) end, Src@1 = begin _pipe@1 = Src(Flags), gleam@option:from_result( _pipe@1 ) end, Interface@1 = begin _pipe@2 = Interface(Flags), gleam@option:from_result( _pipe@2 ) end, Continuation( Src@1, Dst@1, Interface@1 ) end ) end ) end ) end ) end ). -file("src/sketch_css/commands/generate.gleam", 12). ?DOC(false). -spec css() -> glint:command(nil). css() -> run_glint( fun(Src, Dst, Interface) -> Directories@1 = case sketch_css@utils:directories( Src, Dst, Interface ) of {ok, Directories} -> Directories; _assert_fail -> erlang:error(#{gleam_error => let_assert, message => <<"Pattern match failed, no pattern matched the value."/utf8>>, file => <>, module => <<"sketch_css/commands/generate"/utf8>>, function => <<"css"/utf8>>, line => 14, value => _assert_fail, start => 257, 'end' => 324, pattern_start => 268, pattern_end => 283}) end, gleam_stdlib:println( <<"Compiling Gleam styles files in "/utf8, (erlang:element(2, Directories@1))/binary>> ), gleam_stdlib:println( <<"Writing CSS files to "/utf8, (erlang:element(3, Directories@1))/binary>> ), gleam_stdlib:println( <<"Writing interfaces files to "/utf8, (erlang:element(4, Directories@1))/binary>> ), _pipe = sketch_css@generate:stylesheets(Directories@1), _pipe@1 = gleam@result:map_error(_pipe, fun snag:line_print/1), _pipe@2 = gleam@result:map_error( _pipe@1, fun gleam_stdlib:println/1 ), _pipe@3 = gleam@result:map( _pipe@2, fun(_) -> gleam_stdlib:println(<<"========="/utf8>>), gleam_stdlib:println(<<"Done!"/utf8>>) end ), gleam@result:unwrap_both(_pipe@3) end ).