Skip to content
Closed
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions assets/cmds/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ A few types of JS code are accepted.
- additional [built-in properties of the global object](https://tc39.github.io/ecma262/#sec-additional-properties-of-the-global-object)
- `async` should be added. it won't appear in the above lists because it is not a proper keyword (it's only a keyword in certain contexts but can still be used as a variable name, etc).
- `window`, `document`, `navigator` I can't find in any spec but should be included

## Git

Get all core git commands from `/usr/lib/git-core/`.
194 changes: 194 additions & 0 deletions assets/cmds/git.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
/**
* This is a list of git commands
*
* See the README in this directory for more on how this list is assembled.
*
* There are duplicates, and that's okay. But if you are removing items, be sure to look for multiple entries!
*/
export default {
name: "Git",
commonCmds: [
"clone",
"init",
"add",
"mv",
"reset",
"rm",
"bisect",
"grep",
"log",
"show",
"status",
"branch",
"checkout",
"commit",
"diff",
"merge",
"rebase",
"tag",
"fetch",
"pull",
"push"
],
cmds: [
// keywords
"add",
"add--interactive",
"am",
"annotate",
"apply",
"archive",
"bisect",
"bisect--helper",
"blame",
"branch",
"bundle",
"cat-file",
"check-attr",
"check-ignore",
"check-mailmap",
"checkout",
"checkout-index",
"check-ref-format",
"cherry",
"cherry-pick",
"clean",
"clone",
"column",
"commit",
"commit-tree",
"config",
"count-objects",
"credential",
"credential-cache",
"credential-cache--daemon",
"credential-store",
"daemon",
"describe",
"diff",
"diff-files",
"diff-index",
"difftool",
"difftool--helper",
"diff-tree",
"fast-export",
"fast-import",
"fetch",
"fetch-pack",
"filter-branch",
"fmt-merge-msg",
"for-each-ref",
"format-patch",
"fsck",
"fsck-objects",
"c",
"et-tar-commit-id",
"rep",
"hash-object",
"help",
"http-backend",
"http-fetch",
"http-push",
"map-send",
"ndex-pack",
"nit",
"nit-db",
"nstaweb",
"nterpret-trailers",
"log",
"ls-files",
"ls-remote",
"ls-tree",
"mailinfo",
"mailsplit",
"merge",
"merge-base",
"merge-file",
"merge-index",
"merge-octopus",
"merge-one-file",
"merge-ours",
"merge-recursive",
"merge-resolve",
"merge-subtree",
"mergetool",
"mergetool--lib",
"merge-tree",
"mktag",
"mktree",
"mv",
"name-rev",
"notes",
"pack-objects",
"pack-redundant",
"pack-refs",
"parse-remote",
"patch-id",
"prune",
"prune-packed",
"pull",
"push",
"quiltimport",
"read-tree",
"rebase",
"rebase--am",
"rebase--helper",
"rebase--interactive",
"rebase--merge",
"receive-pack",
"reflog",
"remote",
"remote-ext",
"remote-fd",
"remote-ftp",
"remote-ftps",
"remote-http",
"remote-https",
"remote-testsvn",
"repack",
"replace",
"request-pull",
"rerere",
"reset",
"revert",
"rev-list",
"rev-parse",
"rm",
"send-pack",
"shell",
"sh-i18n",
"sh-i18n--envsubst",
"shortlog",
"show",
"show-branch",
"show-index",
"show-ref",
"sh-prompt",
"sh-setup",
"stage",
"stash",
"status",
"stripspace",
"submodule",
"submodule--helper",
"subtree",
"symbolic-ref",
"ag",
"unpack-file",
"unpack-objects",
"update-index",
"update-ref",
"update-server-info",
"upload-archive",
"upload-pack",
"var",
"verify-commit",
"verify-pack",
"verify-tag",
"web--browse",
"whatchanged",
"worktree",
"write-tree",
"mergetools"
]
};
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
You have {{parseInt(gameDuration/1000)}} seconds to type commands from:
</p>
<p v-bind:class="{ show: showTitle }" id="langs">
BASH &middot; JAVASCRIPT &middot; PYTHON &middot; HTML5
BASH &middot; JAVASCRIPT &middot; PYTHON &middot; HTML5 &middot; GIT
</p>
<p v-bind:class="{ show: showTitle }" id="tagline">
Set the terminal on fire. Type PLAY to begin.
Expand Down
18 changes: 17 additions & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const app = new Vue({
bash: 0,
html: 0,
py: 0,
git: 0,
recentValidCharacters: 0,
totalValidCharacters: 0,
totalValidCommands: 0
Expand Down Expand Up @@ -216,6 +217,8 @@ const app = new Vue({
let pyCommon = cmds.cmdsByLang.py.commonCmds;
let htmlAll = filterCmds(cmds.cmdsByLang.html.cmds);
let htmlCommon = filterCmds(cmds.cmdsByLang.html.commonCmds);
let gitAll = filterCmds(cmds.cmdsByLang.git.cmds);
let gitCommon = filterCmds(cmds.cmdsByLang.git.commonCmds);

let cn = config.GOLDEN_CMDS_COMMON_PER_LANG;
let rn = config.GOLDEN_CMDS_RANDOM_PER_LANG;
Expand All @@ -232,12 +235,16 @@ const app = new Vue({
),
html: _.sampleSize(htmlCommon, cn).concat(
_.sampleSize(_.xor(htmlCommon, htmlAll), rn)
),
git: _.sampleSize(gitCommon, cn).concat(
_.sampleSize(_.xor(gitCommon, gitAll), rn)
)
};
goldenCommands.all = goldenCommands.bash.concat(
goldenCommands.js,
goldenCommands.py,
goldenCommands.html
goldenCommands.html,
goldenCommands.git
);

return goldenCommands;
Expand Down Expand Up @@ -284,6 +291,14 @@ const app = new Vue({
.map(cs => cs.join(""))
.join("");

out += "\n";

// title of fifth language
out += cmds.git().name +"\n"

// commands for fifth language
out += goldCmds.git.map(c => ` - ${c}\n`).join("")

return out;
},
printHighScores: function(leaders) {
Expand Down Expand Up @@ -378,6 +393,7 @@ const app = new Vue({
this.count.bash = 0;
this.count.html = 0;
this.count.py = 0;
this.count.git = 0;
this.count.recentValidCharacters = 0;
this.count.totalValidCharacters = 0;
this.count.totalValidCommands = 0;
Expand Down
11 changes: 9 additions & 2 deletions src/cmds.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,22 @@ import bashCmds from "../assets/cmds/bash.js";
import jsCmds from "../assets/cmds/js.js";
import pyCmds from "../assets/cmds/python.js";
import htmlCmds from "../assets/cmds/html.js";
import gitCmds from "../assets/cmds/git.js";

const allCmds = _.union(
bash().cmds,
js().cmds,
py().cmds,
html().cmds /* and other langs as needed */
html().cmds,
git().cmds /* and other langs as needed */
);

export const cmdsByLang = {
bash: bash(),
js: js(),
py: py(),
html: html()
html: html(),
git: git()
};

export function all() {
Expand All @@ -39,6 +42,10 @@ export function html() {
return htmlCmds;
}

export function git() {
return gitCmds;
}

export function longest() {
return allCmds.reduce(function(a, b) {
return a.length > b.length ? a : b;
Expand Down
6 changes: 5 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ of the following:
- JavaScript keywords, objects, functions
- Python keywords, objects, functions
- HTML5 tags
- Git commands

Press Enter to continue.`;

Expand Down Expand Up @@ -380,6 +381,8 @@ Press Enter to continue.`;
app.cmd += `PYTHON ${app.count.py}\n`;
app.cmd += `JAVASCRIPT ${app.count.js}\n`;
app.cmd += `HTML5 ${app.count.html}\n`;
app.cmd += `GIT ${app.count.git}\n`;


app.cmd += `\nPress Enter to continue.`;

Expand Down Expand Up @@ -751,7 +754,8 @@ function deriveTribe() {
{ tribe: "bash", count: app.count.bash },
{ tribe: "Python", count: app.count.py },
{ tribe: "JavaScript", count: app.count.js },
{ tribe: "HTML", count: app.count.html }
{ tribe: "HTML", count: app.count.html },
{ tribe: "GIT", count: app.count.git }
];

const tribesSorted = _.reverse(_.sortBy(cmdCounts, "count"));
Expand Down