Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds an optional config section to the help ouput for bundles #1011

Merged
merged 1 commit into from
Oct 6, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add config section to bundle help output
Matthew Peck committed Oct 6, 2016
commit 06d4224afd21fc91344af33f2e8f5e3c80c84341
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@
"probe": {:git, "https://github.com/operable/probe.git", "f2197509f01922a28219ab47af4e5c6324f47ac6", []},
"ranch": {:hex, :ranch, "1.2.1", "a6fb992c10f2187b46ffd17ce398ddf8a54f691b81768f9ef5f461ea7e28c762", [:make], []},
"slack": {:git, "https://github.com/operable/Elixir-Slack.git", "a0dae7d46a10f9d7e7924a1c8fe5cef17b7cfb82", [branch: "allow-attachments"]},
"spanner": {:git, "https://github.com/operable/spanner.git", "d336e5b63afe8ca4e66d9cc8c476413d5edcf53a", []},
"spanner": {:git, "https://github.com/operable/spanner.git", "8fc1847ab4e5c3120a7e654081ea0071a92d5d96", []},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.0", "edee20847c42e379bf91261db474ffbe373f8acb56e9079acb6038d4e0bf414f", [:rebar, :make], []},
"table_rex": {:hex, :table_rex, "0.8.3", "1c68dfc6886d6f118f5047b0449d6402ae0ac5709064789e578c2f4659f4064b", [:mix], []},
"uuid": {:hex, :uuid, "1.1.3", "06ca38801a1a95b751701ca40716bb97ddf76dfe7e26da0eec7dba636740d57a", [:mix], []},
16 changes: 16 additions & 0 deletions priv/templates/embedded/help-bundle.greenbar
Original file line number Diff line number Diff line change
@@ -12,6 +12,22 @@ __Description__
~br~
~end~

~if cond=$bundle.config_file.config~
__Configuration__
~br~

~if cond=$bundle.config_file.config.notes~
~$bundle.config_file.config.notes~
~br~
~end~

~each var=$bundle.config_file.config.env as=env_var~
* ~$env_var.var~~if cond=$env_var.description~ - ~$env_var.description~~end~

~end~
~br~
~end~

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since config is typically "set and forget" I think it should probably go near the bottom. Maybe just above the homepage and author.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's actually why I put it at the top. I was thinking that the most important stuff was the command bits and I didn't want them to get pushed off the screen.

~if cond=$bundle.commands not_empty?~
__Commands__
~br~
14 changes: 14 additions & 0 deletions test/cog/chat/slack/templates/embedded/help_bundle_test.exs
Original file line number Diff line number Diff line change
@@ -8,6 +8,13 @@ defmodule Cog.Chat.Slack.Templates.Embedded.HelpBundleTest do
"commands" => [%{"name" => "test-command",
"description" => "does just one thing"}],
"author" => "vanstee",
"config_file" => %{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels a little weird. I know we don't have a db column for this stuff, but it'd still be nice if we rendered it all as if it was one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand. Are you saying that we should add virtual fields for the config bits? I don't think that would change the test here, would it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I think I misunderstood what was going on here. But it still seems weird that we need access to the config_file in the template. I'd be happier if we rendered the config key in the json as if it was a normal model attribute. This is probably fine though.

"config" => %{
"notes" => "Some notes about config",
"env" => [%{"var" => "VAR1", "description" => "description1"},
%{"var" => "VAR2"}]
}
},
"homepage" => "test-bundle.com"}]}


@@ -20,6 +27,13 @@ defmodule Cog.Chat.Slack.Templates.Embedded.HelpBundleTest do

No really, it does a thing

*Configuration*

Some notes about config

• VAR1 - description1
• VAR2

*Commands*

• test-command - does just one thing