main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.9 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | 'use strict'
|
---|
| 2 |
|
---|
| 3 | module.exports = git
|
---|
| 4 | git.displayName = 'git'
|
---|
| 5 | git.aliases = []
|
---|
| 6 | function git(Prism) {
|
---|
| 7 | Prism.languages.git = {
|
---|
| 8 | /*
|
---|
| 9 | * A simple one line comment like in a git status command
|
---|
| 10 | * For instance:
|
---|
| 11 | * $ git status
|
---|
| 12 | * # On branch infinite-scroll
|
---|
| 13 | * # Your branch and 'origin/sharedBranches/frontendTeam/infinite-scroll' have diverged,
|
---|
| 14 | * # and have 1 and 2 different commits each, respectively.
|
---|
| 15 | * nothing to commit (working directory clean)
|
---|
| 16 | */
|
---|
| 17 | comment: /^#.*/m,
|
---|
| 18 | /*
|
---|
| 19 | * Regexp to match the changed lines in a git diff output. Check the example below.
|
---|
| 20 | */
|
---|
| 21 | deleted: /^[-–].*/m,
|
---|
| 22 | inserted: /^\+.*/m,
|
---|
| 23 | /*
|
---|
| 24 | * a string (double and simple quote)
|
---|
| 25 | */
|
---|
| 26 | string: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
|
---|
| 27 | /*
|
---|
| 28 | * a git command. It starts with a random prompt finishing by a $, then "git" then some other parameters
|
---|
| 29 | * For instance:
|
---|
| 30 | * $ git add file.txt
|
---|
| 31 | */
|
---|
| 32 | command: {
|
---|
| 33 | pattern: /^.*\$ git .*$/m,
|
---|
| 34 | inside: {
|
---|
| 35 | /*
|
---|
| 36 | * A git command can contain a parameter starting by a single or a double dash followed by a string
|
---|
| 37 | * For instance:
|
---|
| 38 | * $ git diff --cached
|
---|
| 39 | * $ git log -p
|
---|
| 40 | */
|
---|
| 41 | parameter: /\s--?\w+/
|
---|
| 42 | }
|
---|
| 43 | },
|
---|
| 44 | /*
|
---|
| 45 | * Coordinates displayed in a git diff command
|
---|
| 46 | * For instance:
|
---|
| 47 | * $ git diff
|
---|
| 48 | * diff --git file.txt file.txt
|
---|
| 49 | * index 6214953..1d54a52 100644
|
---|
| 50 | * --- file.txt
|
---|
| 51 | * +++ file.txt
|
---|
| 52 | * @@ -1 +1,2 @@
|
---|
| 53 | * -Here's my tetx file
|
---|
| 54 | * +Here's my text file
|
---|
| 55 | * +And this is the second line
|
---|
| 56 | */
|
---|
| 57 | coord: /^@@.*@@$/m,
|
---|
| 58 | /*
|
---|
| 59 | * Match a "commit [SHA1]" line in a git log output.
|
---|
| 60 | * For instance:
|
---|
| 61 | * $ git log
|
---|
| 62 | * commit a11a14ef7e26f2ca62d4b35eac455ce636d0dc09
|
---|
| 63 | * Author: lgiraudel
|
---|
| 64 | * Date: Mon Feb 17 11:18:34 2014 +0100
|
---|
| 65 | *
|
---|
| 66 | * Add of a new line
|
---|
| 67 | */
|
---|
| 68 | 'commit-sha1': /^commit \w{40}$/m
|
---|
| 69 | }
|
---|
| 70 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.