Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 2.53 KB | None | 0 0
  1. ```go
  2. package main
  3.  
  4. import (
  5.     "fmt"
  6.     "log"
  7.     "os"
  8.  
  9.     "github.com/celicoo/docli"
  10. )
  11.  
  12. var doc = `
  13. usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]
  14.            [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
  15.            [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
  16.            [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
  17.            <command> [<args>]
  18.  
  19. These are common Git commands used in various situations:
  20.  
  21. start a working area (see also: git help tutorial)
  22.     clone      Clone a repository into a new directory
  23.     init       Create an empty Git repository or reinitialize an existing one
  24.  
  25. work on the current change (see also: git help everyday)
  26.     add        Add file contents to the index
  27.     mv         Move or rename a file, a directory, or a symlink
  28.     reset      Reset current HEAD to the specified state
  29.     rm         Remove files from the working tree and from the index
  30.  
  31. examine the history and state (see also: git help revisions)
  32.     bisect     Use binary search to find the commit that introduced a bug
  33.     grep       Print lines matching a pattern
  34.     log        Show commit logs
  35.     show       Show various types of objects
  36.     status     Show the working tree status
  37.  
  38. grow, mark and tweak your common history
  39.     branch     List, create, or delete branches
  40.     checkout   Switch branches or restore working tree files
  41.     commit     Record changes to the repository
  42.     diff       Show changes between commits, commit and working tree, etc
  43.     merge      Join two or more development histories together
  44.     rebase     Reapply commits on top of another base tip
  45.     tag        Create, list, delete or verify a tag object signed with GPG
  46.  
  47. collaborate (see also: git help workflows)
  48.     fetch      Download objects and refs from another repository
  49.     pull       Fetch from and integrate with another repository or a local branch
  50.     push       Update remote refs along with associated objects
  51.  
  52. 'git help -a' and 'git help -g' list available subcommands and some
  53. concept guides. See 'git help <command>' or 'git help <concept>'
  54. to read about a specific subcommand or concept.
  55. `
  56.  
  57. type Git struct {
  58.     Clone,
  59.     Init,
  60.     Add,
  61.     Mv,
  62.     Reset,
  63.     Rm,
  64.     Bisect,
  65.     Grep,
  66.     Log,
  67.     Show,
  68.     Status,
  69.     Branch,
  70.     Checkout,
  71.     Commit,
  72.     Diff,
  73.     Merge,
  74.     Rebase,
  75.     Tag,
  76.     Fetch,
  77.     Pull,
  78.     Push bool
  79. }
  80.  
  81. func main() {
  82.     args, err := docli.Parse(doc)
  83.     if err != nil {
  84.         log.Fatal(err)
  85.     }
  86.  
  87.     var git Git
  88.     args.Bind(&git)
  89.     if git.Init {
  90.         pwd, _ := os.Getwd()
  91.         fmt.Printf("Initialized empty Git repository in %s\n", pwd)
  92.     }
  93. }
  94. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement