- {:ok, file} = File.open(config_path, [:write])
- json = generate_json(descriptions)
- IO.write(file, json)
- :ok = File.close(file)
- {:ok, config_path}
+
+ with {:ok, file} <- File.open(config_path, [:write]),
+ json <- generate_json(descriptions),
+ :ok <- IO.write(file, json),
+ :ok <- File.close(file) do
+ {:ok, config_path}
+ end