Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9aa9609

Browse filesBrowse files
committed
cleaning up annotated source references
1 parent 6a13a01 commit 9aa9609
Copy full SHA for 9aa9609

File tree

Expand file treeCollapse file tree

1 file changed

+19
-19
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+19
-19
lines changed

‎githubconsole.html

Copy file name to clipboardExpand all lines: githubconsole.html
+19-19Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,13 @@ <h2>The GitHub API</h2>
111111
<code>Josh.PathHandler</code>'s area of applicability.</p>
112112

113113
<p>The user object comes from:</p>
114-
<pre>GET /users/:user</pre>
114+
<pre><code>GET /users/:user</code></pre>
115115
<p>We never fetch an individual repository, instead opting to fetch all for the current user at user initialization via:</p>
116-
<pre>GET /users/:user/repos</pre>
116+
<pre><code>GET /users/:user/repos</code></pre>
117117
<p>We do the same for branches, fetching all, lazily, once we need to list or autocomplete them:</p>
118-
<pre>GET /repos/:owner/:repo/branches</pre>
118+
<pre><code>GET /repos/:owner/:repo/branches</code></pre>
119119
<p>Finally, we fetch the current directory via</p>
120-
<pre>GET /repos/:owner/:repo/contents/:path</pre>
120+
<pre><code>GET /repos/:owner/:repo/contents/:path</code></pre>
121121
<p>This is done for the root during repo initialization, and for path completion and <code>cd</code> on demand.</p>
122122

123123
<p> The API returns
@@ -128,7 +128,7 @@ <h2>The GitHub API</h2>
128128
<h2>Initializing the Console</h2>
129129

130130
<p>In order for us to show the console, we have to have initialized a user, a repository and retrieved it's root directory. This is done after
131-
<a href="docs/githubconsole.html#document.ready" target="_blank"><code>document.ready</code></a></p>
131+
<a href="docs/githubconsole.html#document.ready" target="docs"><code>document.ready</code></a></p>
132132
<pre><code>$(document).ready(function() {
133133
setUser("sdether", "josh.js",
134134
function(msg) {
@@ -139,7 +139,7 @@ <h2>Initializing the Console</h2>
139139
});</code></pre>
140140

141141
<p>We call
142-
<a href="docs/githubconsole.html#setUser" target="_blank"><code>setUser(user_name, repo_name, err, callback)</code></a> for
142+
<a href="docs/githubconsole.html#setUser" target="docs"><code>setUser(user_name, repo_name, err, callback)</code></a> for
143143
<em>sdether</em> and
144144
<em>josh.js</em>, before setting the authenticated user as the current user and initializing the UI of the shell.
145145
</p>
@@ -165,14 +165,14 @@ <h2>Initializing the Console</h2>
165165
</p>
166166

167167
<p>All API access goes through a helper function
168-
<a href="docs/githubconsole.html#get" target="_blank"><code>get(resource, args, callback)</code></a>, which is responsible for constructing the
168+
<a href="docs/githubconsole.html#get" target="docs"><code>get(resource, args, callback)</code></a>, which is responsible for constructing the
169169
<em>json</em> call and inspecting the response. For simplicity, all error conditions just result in
170170
<em>callback</em> being called with null instead of a
171171
<em>json</em> payload. Also for simplicity, any initialization failure, just bails out via
172-
<a href="docs/githubconsole.html#initializationError" target="_blank"><code>initializationError()</code></a>.</p>
172+
<a href="docs/githubconsole.html#initializationError" target="docs"><code>initializationError()</code></a>.</p>
173173

174174
<p>Once we have a user, we can call
175-
<a href="docs/githubconsole.html#initializeRepos" target="_blank"><code>initializeRepos(user, repo_name, err, callback)</code></a>.
175+
<a href="docs/githubconsole.html#initializeRepos" target="docs"><code>initializeRepos(user, repo_name, err, callback)</code></a>.
176176
</p>
177177

178178
<h2>Adding Commands</h2>
@@ -193,19 +193,19 @@ <h2>Adding Commands</h2>
193193
<code>setUser</code>, Josh functions do not have a separate error handler. Since Josh interacts with the UI, it has no concept of failure -- it has to execute the callback to continue executing. It is up to the caller to deal with errors and transform them into the appropriate UI response. But it still gives us the flexibility to undertake an asynchronous actions, such as calling a remote API and complete the function execution upon the asynchronous return of the remote call.
194194
</p>
195195

196-
<h3><a href="docs/githubconsole.html#cmd.user" target="_blank">user [<em>username</em>]</a></h3>
196+
<h3><a href="docs/githubconsole.html#cmd.user" target="docs">user [<em>username</em>]</a></h3>
197197

198-
<p>The <a href="docs/githubconsole.html#cmd.user" target="_blank"><code>user</code></a> command does not have
198+
<p>The <a href="docs/githubconsole.html#cmd.user" target="docs"><code>user</code></a> command does not have
199199
<code>TAB</code> completion, since doing efficient tab completion against the full set of GitHub users is beyond this tutorial. Instead it expects a valid username to call
200-
<a href="docs/githubconsole.html#setUser" target="_blank"><code>setUser(user_name, repo_name, err, callback)</code></a> with and on completion renders the user template with the new current user.
200+
<a href="docs/githubconsole.html#setUser" target="docs"><code>setUser(user_name, repo_name, err, callback)</code></a> with and on completion renders the user template with the new current user.
201201
</p>
202202

203203
<p>If called without a <em>username</em>, we simply render user template with the current user.</p>
204204

205-
<h3><a href="docs/githubconsole.html#cmd.repo" target="_blank">repo [<em>-l | reponame</em>]</a></h3>
205+
<h3><a href="docs/githubconsole.html#cmd.repo" target="docs">repo [<em>-l | reponame</em>]</a></h3>
206206

207207
<p>The
208-
<a href="docs/githubconsole.html#cmd.repo" target="_blank"><code>repo</code></a> command can either show information about the current repository, change the current repository or list all repositories belonging to the user. It also provides
208+
<a href="docs/githubconsole.html#cmd.repo" target="docs"><code>repo</code></a> command can either show information about the current repository, change the current repository or list all repositories belonging to the user. It also provides
209209
<code>TAB</code> completion of partial repository names against the repositories of the current user.</p>
210210

211211
<p>Given no argument, we simply render the repository template with the current repository</p>
@@ -214,7 +214,7 @@ <h3><a href="docs/githubconsole.html#cmd.repo" target="_blank">repo [<em>-l | re
214214
<em>-l</em>, we render the repository list template with the repositories we fetched on user initialization.</p>
215215

216216
<p>Finally, the argument is used to try and retrieve the repository from the known repositories. If that succeeds, we call
217-
<a href="docs/githubconsole.html#setRepo" target="_blank"><code>setRepo(repo, err, callback)</code></a>, which fetches the root directory to initialize the current node of
217+
<a href="docs/githubconsole.html#setRepo" target="docs"><code>setRepo(repo, err, callback)</code></a>, which fetches the root directory to initialize the current node of
218218
<code>Josh.PathHandler</code> before changing the current repository to the one specified. Upon switching we again render the repository template with the now current repository.
219219
</p>
220220

@@ -223,18 +223,18 @@ <h3><a href="docs/githubconsole.html#cmd.repo" target="_blank">repo [<em>-l | re
223223
<code>bestMatch</code> takes care of creating the completion object with the appropriate argument completion and list of possible choices.
224224
</p>
225225

226-
<h3><a href="docs/githubconsole.html#cmd.branch" target="_blank">branch [<em>-l | branchname</em>]</a></h3>
226+
<h3><a href="docs/githubconsole.html#cmd.branch" target="docs">branch [<em>-l | branchname</em>]</a></h3>
227227

228228
<p>T can either show information about the current repository, change the current repository or list all repositories belonging to the user. It also provides
229229
<code>TAB</code> completion of partial repository names against the repositories of the current user.</p>
230230

231231
<p>Given no argument, the
232-
<a href="docs/githubconsole.html#cmd.branch" target="_blank"><code>branch</code></a> command simply prints the current branch name. The
232+
<a href="docs/githubconsole.html#cmd.branch" target="docs"><code>branch</code></a> command simply prints the current branch name. The
233233
<em>-l</em> argument renders a list of all known branches for the current repository, while an actualy branchname as argument will cause the console to change its current branch.
234234
</p>
235235

236236
<p>Showing the list of branches uses
237-
<a href="docs/githubconsole.html#ensureBranches" target="_blank"><code>ensureBranches(err, callback)</code></a> to lazily initialize the list of branches from the API.
237+
<a href="docs/githubconsole.html#ensureBranches" target="docs"><code>ensureBranches(err, callback)</code></a> to lazily initialize the list of branches from the API.
238238
</p>
239239

240240
<p>The completion handler for the command simply calls
@@ -243,7 +243,7 @@ <h3><a href="docs/githubconsole.html#cmd.branch" target="_blank">branch [<em>-l
243243
</p>
244244

245245
<h2>Wiring up Josh.PathHandler</h2>
246-
<p><code>PathHandler</code> provides unix filepath handling. This works by abstracting the filesystem into two operations, <a href="docs/githubconsole.html#getNode" target="_blank"><code>getNode(path, callback)</code></a> and <a href="docs/githubconsole.html#getChildNodes" target="_blank"><code>getChildNodes(node, callback)</code></a>. The former returns a file node given a path string while the latter returns file nodes for all children of a given node. With these two all tree operations including <code>TAB</code> completion can be accomplished by <code>PathHandler</code>.</p>
246+
<p><code>PathHandler</code> provides unix filepath handling. This works by abstracting the filesystem into two operations, <a href="docs/githubconsole.html#getNode" target="docs"><code>getNode(path, callback)</code></a> and <a href="docs/githubconsole.html#getChildNodes" target="docs"><code>getChildNodes(node, callback)</code></a>. The former returns a file node given a path string while the latter returns file nodes for all children of a given node. With these two all tree operations including <code>TAB</code> completion can be accomplished by <code>PathHandler</code>.</p>
247247
<p>A file node is an opaque object in which we can track any file state we want but has to have two properties:</p>
248248
<pre><code>{
249249
name: 'localname',

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.