{"action":"created","comment":{"url":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/comments/27011076","id":27011076,"diff_hunk":"@@ -0,0 +1,161 @@\n+///<reference path=\"../../.d.ts\"/>\n+\"use strict\";\n+\n+import util = require(\"util\");\n+import Future = require(\"fibers/future\");\n+import path = require(\"path\");\n+import options = require(\"options\");\n+import marked = require(\"marked\");\n+var TerminalRenderer = require('marked-terminal');\n+var chalk = require(\"chalk\");\n+\n+export class HtmlHelpService implements IHtmlHelpService {\n+\tprivate static MARKDOWN_FILE_EXTENSION = \".md\";\n+\tprivate static HTML_FILE_EXTENSION = \".html\";\n+\tprivate static MAN_PAGE_NAME_PLACEHOLDER = \"@MAN_PAGE_NAME@\";\n+\tprivate static HTML_COMMAND_HELP_PLACEHOLDER = \"@HTML_COMMAND_HELP@\";\n+\tprivate static RELATIVE_PATH_TO_STYLES_CSS_PLACEHOLDER = \"@RELATIVE_PATH_TO_STYLES_CSS@\";\n+\n+\tprivate pathToManPages: string;","path":"services/html-help-service.ts","position":19,"original_position":19,"commit_id":"9cfe40a216cc8b9619f733007c709c08ff47032b","original_commit_id":"9cfe40a216cc8b9619f733007c709c08ff47032b","user":{"login":"rosen-vladimirov","id":8351653,"avatar_url":"https://avatars.githubusercontent.com/u/8351653?v=3","gravatar_id":"","url":"https://api.github.com/users/rosen-vladimirov","html_url":"https://github.com/rosen-vladimirov","followers_url":"https://api.github.com/users/rosen-vladimirov/followers","following_url":"https://api.github.com/users/rosen-vladimirov/following{/other_user}","gists_url":"https://api.github.com/users/rosen-vladimirov/gists{/gist_id}","starred_url":"https://api.github.com/users/rosen-vladimirov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rosen-vladimirov/subscriptions","organizations_url":"https://api.github.com/users/rosen-vladimirov/orgs","repos_url":"https://api.github.com/users/rosen-vladimirov/repos","events_url":"https://api.github.com/users/rosen-vladimirov/events{/privacy}","received_events_url":"https://api.github.com/users/rosen-vladimirov/received_events","type":"User","site_admin":false},"body":"The reasons is caching of the result.\r\n staticConfig is executing ```path.join``` when getting HTML_PAGES_DIR and MAN_PAGES_DIR, I do not want to execute it every time. ","created_at":"2015-03-24T09:04:54Z","updated_at":"2015-03-24T09:04:54Z","html_url":"https://github.com/telerik/mobile-cli-lib/pull/241#discussion_r27011076","pull_request_url":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/241","_links":{"self":{"href":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/comments/27011076"},"html":{"href":"https://github.com/telerik/mobile-cli-lib/pull/241#discussion_r27011076"},"pull_request":{"href":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/241"}}},"pull_request":{"url":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/241","id":31780599,"html_url":"https://github.com/telerik/mobile-cli-lib/pull/241","diff_url":"https://github.com/telerik/mobile-cli-lib/pull/241.diff","patch_url":"https://github.com/telerik/mobile-cli-lib/pull/241.patch","issue_url":"https://api.github.com/repos/telerik/mobile-cli-lib/issues/241","number":241,"state":"open","locked":false,"title":"Show HTML Help","user":{"login":"rosen-vladimirov","id":8351653,"avatar_url":"https://avatars.githubusercontent.com/u/8351653?v=3","gravatar_id":"","url":"https://api.github.com/users/rosen-vladimirov","html_url":"https://github.com/rosen-vladimirov","followers_url":"https://api.github.com/users/rosen-vladimirov/followers","following_url":"https://api.github.com/users/rosen-vladimirov/following{/other_user}","gists_url":"https://api.github.com/users/rosen-vladimirov/gists{/gist_id}","starred_url":"https://api.github.com/users/rosen-vladimirov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rosen-vladimirov/subscriptions","organizations_url":"https://api.github.com/users/rosen-vladimirov/orgs","repos_url":"https://api.github.com/users/rosen-vladimirov/repos","events_url":"https://api.github.com/users/rosen-vladimirov/events{/privacy}","received_events_url":"https://api.github.com/users/rosen-vladimirov/received_events","type":"User","site_admin":false},"body":"## Use case:\r\nCLIs should be able to show HTML help when using ```<cli name> help <command name>```\r\nWhen using ```<cli name> <command name> --help``` console help should be shown.\r\nWhen an error is raised in command, only console help is shown.\r\n\r\n## Implementation\r\n* ```HelpCommand``` is modified to show console help when ```options.help``` is specified and html help when it is not.\r\n* Add ```HtmlHelpService``` which handles both console and html help by parsing markdown help files.\r\n* Each commands help is placed in a separate file. The files are markdown and they are used for both html and console help.\r\n* Html pages are generated from markdown on post-install. As post-install command could fail before generating html pages, when html help should be shown, we check if command name is valid and if the command exists, but its html help is missing, we generate all html pages.\r\n* Modify ```CommandsService``` to show console help by specifying options.help before calling ```HelpCommand```\r\n* Modify ```DynamicHelpService``` and ```DynamicHelpProvider``` to accept isHtml option. When ```isHtml``` is specified, all localVariables will be set to true. This way html help will show full help, no matter of the conditions.\r\n* Add ```basic_page.html``` page and used three placeholders in it. The page is used to generate all html files, by replacing the placeholders with commands name, help content and path to css file.\r\n* Add ```styles.css``` file which contains styles used in html pages.\r\n* Add definitions for marked module.\r\n* Add ```appendFile``` method to ```FileSystem```\r\n* Fix issue in yok, which was not requiring the first hierarchical command if it was not default one (if the hierarchical command doesn't have default command to execute) - this was leading to incorrect behavior when checking if command is valid.\r\n\r\nhttp://teampulse.telerik.com/view#item/259417","created_at":"2015-03-23T22:28:18Z","updated_at":"2015-03-24T09:04:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5cbc15328a315a95c3652e9d8072c727bab05094","assignee":{"login":"rosen-vladimirov","id":8351653,"avatar_url":"https://avatars.githubusercontent.com/u/8351653?v=3","gravatar_id":"","url":"https://api.github.com/users/rosen-vladimirov","html_url":"https://github.com/rosen-vladimirov","followers_url":"https://api.github.com/users/rosen-vladimirov/followers","following_url":"https://api.github.com/users/rosen-vladimirov/following{/other_user}","gists_url":"https://api.github.com/users/rosen-vladimirov/gists{/gist_id}","starred_url":"https://api.github.com/users/rosen-vladimirov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rosen-vladimirov/subscriptions","organizations_url":"https://api.github.com/users/rosen-vladimirov/orgs","repos_url":"https://api.github.com/users/rosen-vladimirov/repos","events_url":"https://api.github.com/users/rosen-vladimirov/events{/privacy}","received_events_url":"https://api.github.com/users/rosen-vladimirov/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/telerik/mobile-cli-lib/milestones/4","html_url":"https://github.com/telerik/mobile-cli-lib/milestones/AB%202.9.0","labels_url":"https://api.github.com/repos/telerik/mobile-cli-lib/milestones/4/labels","id":958029,"number":4,"title":"AB 2.9.0","description":"","creator":{"login":"teobugslayer","id":5443453,"avatar_url":"https://avatars.githubusercontent.com/u/5443453?v=3","gravatar_id":"","url":"https://api.github.com/users/teobugslayer","html_url":"https://github.com/teobugslayer","followers_url":"https://api.github.com/users/teobugslayer/followers","following_url":"https://api.github.com/users/teobugslayer/following{/other_user}","gists_url":"https://api.github.com/users/teobugslayer/gists{/gist_id}","starred_url":"https://api.github.com/users/teobugslayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teobugslayer/subscriptions","organizations_url":"https://api.github.com/users/teobugslayer/orgs","repos_url":"https://api.github.com/users/teobugslayer/repos","events_url":"https://api.github.com/users/teobugslayer/events{/privacy}","received_events_url":"https://api.github.com/users/teobugslayer/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":19,"state":"open","created_at":"2015-01-30T09:10:36Z","updated_at":"2015-03-23T22:28:35Z","due_on":"2015-04-23T21:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/241/commits","review_comments_url":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/241/comments","review_comment_url":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/comments{/number}","comments_url":"https://api.github.com/repos/telerik/mobile-cli-lib/issues/241/comments","statuses_url":"https://api.github.com/repos/telerik/mobile-cli-lib/statuses/9cfe40a216cc8b9619f733007c709c08ff47032b","head":{"label":"telerik:vladimirov/html-help","ref":"vladimirov/html-help","sha":"9cfe40a216cc8b9619f733007c709c08ff47032b","user":{"login":"telerik","id":568561,"avatar_url":"https://avatars.githubusercontent.com/u/568561?v=3","gravatar_id":"","url":"https://api.github.com/users/telerik","html_url":"https://github.com/telerik","followers_url":"https://api.github.com/users/telerik/followers","following_url":"https://api.github.com/users/telerik/following{/other_user}","gists_url":"https://api.github.com/users/telerik/gists{/gist_id}","starred_url":"https://api.github.com/users/telerik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telerik/subscriptions","organizations_url":"https://api.github.com/users/telerik/orgs","repos_url":"https://api.github.com/users/telerik/repos","events_url":"https://api.github.com/users/telerik/events{/privacy}","received_events_url":"https://api.github.com/users/telerik/received_events","type":"Organization","site_admin":false},"repo":{"id":21348075,"name":"mobile-cli-lib","full_name":"telerik/mobile-cli-lib","owner":{"login":"telerik","id":568561,"avatar_url":"https://avatars.githubusercontent.com/u/568561?v=3","gravatar_id":"","url":"https://api.github.com/users/telerik","html_url":"https://github.com/telerik","followers_url":"https://api.github.com/users/telerik/followers","following_url":"https://api.github.com/users/telerik/following{/other_user}","gists_url":"https://api.github.com/users/telerik/gists{/gist_id}","starred_url":"https://api.github.com/users/telerik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telerik/subscriptions","organizations_url":"https://api.github.com/users/telerik/orgs","repos_url":"https://api.github.com/users/telerik/repos","events_url":"https://api.github.com/users/telerik/events{/privacy}","received_events_url":"https://api.github.com/users/telerik/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/telerik/mobile-cli-lib","description":"Contains common infrastructure for CLIs - mainly AppBuilder and NativeScript.","fork":false,"url":"https://api.github.com/repos/telerik/mobile-cli-lib","forks_url":"https://api.github.com/repos/telerik/mobile-cli-lib/forks","keys_url":"https://api.github.com/repos/telerik/mobile-cli-lib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/telerik/mobile-cli-lib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/telerik/mobile-cli-lib/teams","hooks_url":"https://api.github.com/repos/telerik/mobile-cli-lib/hooks","issue_events_url":"https://api.github.com/repos/telerik/mobile-cli-lib/issues/events{/number}","events_url":"https://api.github.com/repos/telerik/mobile-cli-lib/events","assignees_url":"https://api.github.com/repos/telerik/mobile-cli-lib/assignees{/user}","branches_url":"https://api.github.com/repos/telerik/mobile-cli-lib/branches{/branch}","tags_url":"https://api.github.com/repos/telerik/mobile-cli-lib/tags","blobs_url":"https://api.github.com/repos/telerik/mobile-cli-lib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/telerik/mobile-cli-lib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/telerik/mobile-cli-lib/git/refs{/sha}","trees_url":"https://api.github.com/repos/telerik/mobile-cli-lib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/telerik/mobile-cli-lib/statuses/{sha}","languages_url":"https://api.github.com/repos/telerik/mobile-cli-lib/languages","stargazers_url":"https://api.github.com/repos/telerik/mobile-cli-lib/stargazers","contributors_url":"https://api.github.com/repos/telerik/mobile-cli-lib/contributors","subscribers_url":"https://api.github.com/repos/telerik/mobile-cli-lib/subscribers","subscription_url":"https://api.github.com/repos/telerik/mobile-cli-lib/subscription","commits_url":"https://api.github.com/repos/telerik/mobile-cli-lib/commits{/sha}","git_commits_url":"https://api.github.com/repos/telerik/mobile-cli-lib/git/commits{/sha}","comments_url":"https://api.github.com/repos/telerik/mobile-cli-lib/comments{/number}","issue_comment_url":"https://api.github.com/repos/telerik/mobile-cli-lib/issues/comments{/number}","contents_url":"https://api.github.com/repos/telerik/mobile-cli-lib/contents/{+path}","compare_url":"https://api.github.com/repos/telerik/mobile-cli-lib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/telerik/mobile-cli-lib/merges","archive_url":"https://api.github.com/repos/telerik/mobile-cli-lib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/telerik/mobile-cli-lib/downloads","issues_url":"https://api.github.com/repos/telerik/mobile-cli-lib/issues{/number}","pulls_url":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls{/number}","milestones_url":"https://api.github.com/repos/telerik/mobile-cli-lib/milestones{/number}","notifications_url":"https://api.github.com/repos/telerik/mobile-cli-lib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/telerik/mobile-cli-lib/labels{/name}","releases_url":"https://api.github.com/repos/telerik/mobile-cli-lib/releases{/id}","created_at":"2014-06-30T10:54:52Z","updated_at":"2015-03-20T09:25:32Z","pushed_at":"2015-03-23T23:09:16Z","git_url":"git://github.com/telerik/mobile-cli-lib.git","ssh_url":"git@github.com:telerik/mobile-cli-lib.git","clone_url":"https://github.com/telerik/mobile-cli-lib.git","svn_url":"https://github.com/telerik/mobile-cli-lib","homepage":null,"size":10016,"stargazers_count":5,"watchers_count":5,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":5,"forks":1,"open_issues":5,"watchers":5,"default_branch":"master"}},"base":{"label":"telerik:master","ref":"master","sha":"866e12e6f8c63a58ec298c79966316e1b9aa1e5f","user":{"login":"telerik","id":568561,"avatar_url":"https://avatars.githubusercontent.com/u/568561?v=3","gravatar_id":"","url":"https://api.github.com/users/telerik","html_url":"https://github.com/telerik","followers_url":"https://api.github.com/users/telerik/followers","following_url":"https://api.github.com/users/telerik/following{/other_user}","gists_url":"https://api.github.com/users/telerik/gists{/gist_id}","starred_url":"https://api.github.com/users/telerik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telerik/subscriptions","organizations_url":"https://api.github.com/users/telerik/orgs","repos_url":"https://api.github.com/users/telerik/repos","events_url":"https://api.github.com/users/telerik/events{/privacy}","received_events_url":"https://api.github.com/users/telerik/received_events","type":"Organization","site_admin":false},"repo":{"id":21348075,"name":"mobile-cli-lib","full_name":"telerik/mobile-cli-lib","owner":{"login":"telerik","id":568561,"avatar_url":"https://avatars.githubusercontent.com/u/568561?v=3","gravatar_id":"","url":"https://api.github.com/users/telerik","html_url":"https://github.com/telerik","followers_url":"https://api.github.com/users/telerik/followers","following_url":"https://api.github.com/users/telerik/following{/other_user}","gists_url":"https://api.github.com/users/telerik/gists{/gist_id}","starred_url":"https://api.github.com/users/telerik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telerik/subscriptions","organizations_url":"https://api.github.com/users/telerik/orgs","repos_url":"https://api.github.com/users/telerik/repos","events_url":"https://api.github.com/users/telerik/events{/privacy}","received_events_url":"https://api.github.com/users/telerik/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/telerik/mobile-cli-lib","description":"Contains common infrastructure for CLIs - mainly AppBuilder and NativeScript.","fork":false,"url":"https://api.github.com/repos/telerik/mobile-cli-lib","forks_url":"https://api.github.com/repos/telerik/mobile-cli-lib/forks","keys_url":"https://api.github.com/repos/telerik/mobile-cli-lib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/telerik/mobile-cli-lib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/telerik/mobile-cli-lib/teams","hooks_url":"https://api.github.com/repos/telerik/mobile-cli-lib/hooks","issue_events_url":"https://api.github.com/repos/telerik/mobile-cli-lib/issues/events{/number}","events_url":"https://api.github.com/repos/telerik/mobile-cli-lib/events","assignees_url":"https://api.github.com/repos/telerik/mobile-cli-lib/assignees{/user}","branches_url":"https://api.github.com/repos/telerik/mobile-cli-lib/branches{/branch}","tags_url":"https://api.github.com/repos/telerik/mobile-cli-lib/tags","blobs_url":"https://api.github.com/repos/telerik/mobile-cli-lib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/telerik/mobile-cli-lib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/telerik/mobile-cli-lib/git/refs{/sha}","trees_url":"https://api.github.com/repos/telerik/mobile-cli-lib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/telerik/mobile-cli-lib/statuses/{sha}","languages_url":"https://api.github.com/repos/telerik/mobile-cli-lib/languages","stargazers_url":"https://api.github.com/repos/telerik/mobile-cli-lib/stargazers","contributors_url":"https://api.github.com/repos/telerik/mobile-cli-lib/contributors","subscribers_url":"https://api.github.com/repos/telerik/mobile-cli-lib/subscribers","subscription_url":"https://api.github.com/repos/telerik/mobile-cli-lib/subscription","commits_url":"https://api.github.com/repos/telerik/mobile-cli-lib/commits{/sha}","git_commits_url":"https://api.github.com/repos/telerik/mobile-cli-lib/git/commits{/sha}","comments_url":"https://api.github.com/repos/telerik/mobile-cli-lib/comments{/number}","issue_comment_url":"https://api.github.com/repos/telerik/mobile-cli-lib/issues/comments{/number}","contents_url":"https://api.github.com/repos/telerik/mobile-cli-lib/contents/{+path}","compare_url":"https://api.github.com/repos/telerik/mobile-cli-lib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/telerik/mobile-cli-lib/merges","archive_url":"https://api.github.com/repos/telerik/mobile-cli-lib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/telerik/mobile-cli-lib/downloads","issues_url":"https://api.github.com/repos/telerik/mobile-cli-lib/issues{/number}","pulls_url":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls{/number}","milestones_url":"https://api.github.com/repos/telerik/mobile-cli-lib/milestones{/number}","notifications_url":"https://api.github.com/repos/telerik/mobile-cli-lib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/telerik/mobile-cli-lib/labels{/name}","releases_url":"https://api.github.com/repos/telerik/mobile-cli-lib/releases{/id}","created_at":"2014-06-30T10:54:52Z","updated_at":"2015-03-20T09:25:32Z","pushed_at":"2015-03-23T23:09:16Z","git_url":"git://github.com/telerik/mobile-cli-lib.git","ssh_url":"git@github.com:telerik/mobile-cli-lib.git","clone_url":"https://github.com/telerik/mobile-cli-lib.git","svn_url":"https://github.com/telerik/mobile-cli-lib","homepage":null,"size":10016,"stargazers_count":5,"watchers_count":5,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":5,"forks":1,"open_issues":5,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/241"},"html":{"href":"https://github.com/telerik/mobile-cli-lib/pull/241"},"issue":{"href":"https://api.github.com/repos/telerik/mobile-cli-lib/issues/241"},"comments":{"href":"https://api.github.com/repos/telerik/mobile-cli-lib/issues/241/comments"},"review_comments":{"href":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/241/comments"},"review_comment":{"href":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/241/commits"},"statuses":{"href":"https://api.github.com/repos/telerik/mobile-cli-lib/statuses/9cfe40a216cc8b9619f733007c709c08ff47032b"}}}}