Deployment and lifecycle management for Nix
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cli: fix TTY-less output, e.g. CI

+16 -3
+15 -2
apps/sower_cli/lib/sower_cli/output.ex
··· 5 5 6 6 @doc """ 7 7 Initialize output mode. When debug is true, uses simple line-by-line output. 8 - When false, uses Owl.LiveScreen for in-place updates. 8 + When false, uses Owl.LiveScreen for in-place updates (if TTY is available). 9 9 """ 10 10 def init(opts \\ []) do 11 - if opts[:debug] do 11 + if opts[:debug] or not tty?() do 12 12 Process.put(:output_mode, :simple) 13 13 else 14 14 Application.ensure_all_started(:owl) 15 15 Process.put(:output_mode, :live) 16 + end 17 + end 18 + 19 + defp tty? do 20 + # Check if stdout is a TTY 21 + case :io.getopts(:standard_io) do 22 + {:ok, _} -> 23 + # Also check if we're in a CI environment 24 + System.get_env("CI") not in ["true", "1"] 25 + 26 + _ -> 27 + false 16 28 end 17 29 end 18 30 ··· 56 68 state: {action, name, :pending}, 57 69 render: &render_item/1 58 70 ) 71 + 59 72 Owl.LiveScreen.await_render() 60 73 else 61 74 IO.puts(" #{IO.ANSI.yellow()}⋯#{IO.ANSI.reset()} #{action} #{name}")
+1 -1
nix/packages/cli.nix
··· 40 40 41 41 doCheck = true; 42 42 43 - meta.mainProgram = "sower-cli"; 43 + meta.mainProgram = "sower"; 44 44 }