github.com/andrewlunde/glide@v0.20.1/docs/commands.md (about)

     1  # Commands
     2  
     3  The following are the Glide commands, most of which are to help you manage your workspace.
     4  
     5  ## glide create (aliased to init)
     6  
     7  Initialize a new workspace. Among other things, this creates a `glide.yaml` file
     8  while attempting to guess the packages and versions to put in it. For example,
     9  if your project is using Godep it will use the versions specified there. Glide
    10  is smart enough to scan your codebase and detect the imports being used whether
    11  they are specified with another package manager or not.
    12  
    13      $ glide create
    14      [INFO]	Generating a YAML configuration file and guessing the dependencies
    15      [INFO]	Attempting to import from other package managers (use --skip-import to skip)
    16      [INFO]	Scanning code to look for dependencies
    17      [INFO]	--> Found reference to github.com/Masterminds/semver
    18      [INFO]	--> Found reference to github.com/Masterminds/vcs
    19      [INFO]	--> Found reference to github.com/urfave/cli
    20      [INFO]	--> Found reference to gopkg.in/yaml.v2
    21      [INFO]	Writing configuration file (glide.yaml)
    22      [INFO]	Would you like Glide to help you find ways to improve your glide.yaml configuration?
    23      [INFO]	If you want to revisit this step you can use the config-wizard command at any time.
    24      [INFO]	Yes (Y) or No (N)?
    25      n
    26      [INFO]	You can now edit the glide.yaml file. Consider:
    27      [INFO]	--> Using versions and ranges. See https://glide.sh/docs/versions/
    28      [INFO]	--> Adding additional metadata. See https://glide.sh/docs/glide.yaml/
    29      [INFO]	--> Running the config-wizard command to improve the versions in your configuration
    30  
    31  The `config-wizard`, noted here, can be run here or manually run at a later time.
    32  This wizard helps you figure out versions and ranges you can use for your
    33  dependencies.
    34  
    35  ### glide config-wizard
    36  
    37  This runs a wizard that scans your dependencies and retrieves information on them
    38  to offer up suggestions that you can interactively choose. For example, it can
    39  discover if a dependency uses semantic versions and help you choose the version
    40  ranges to use.
    41  
    42  ## glide get [package name]
    43  
    44  You can download one or more packages to your `vendor` directory and have it added to your
    45  `glide.yaml` file with `glide get`.
    46  
    47      $ glide get github.com/andrewlunde/cookoo
    48  
    49  When `glide get` is used it will introspect the listed package to resolve its dependencies including using Godep, GPM, Gom, and GB config files.
    50  
    51  The `glide get` command can have a [version or range](versions.md) passed in with the package name. For example,
    52  
    53      $ glide get github.com/andrewlunde/cookoo#^1.2.3
    54  
    55  The version is separated from the package name by an anchor (`#`). If no version or range is specified and the dependency uses Semantic Versions Glide will prompt you to ask if you want to use them.
    56  
    57  ## glide update (aliased to up)
    58  
    59  Download or update all of the libraries listed in the `glide.yaml` file and put
    60  them in the `vendor` directory. It will also recursively walk through the
    61  dependency packages to fetch anything that's needed and read in any configuration.
    62  
    63      $ glide up
    64  
    65  This will recurse over the packages looking for other projects managed by Glide,
    66  Godep, gb, gom, and GPM. When one is found those packages will be installed as needed.
    67  
    68  A `glide.lock` file will be created or updated with the dependencies pinned to
    69  specific versions. For example, if in the `glide.yaml` file a version was
    70  specified as a range (e.g., `^1.2.3`) it will be set to a specific commit id in
    71  the `glide.lock` file. That allows for reproducible installs (see `glide install`).
    72  
    73  To remove any nested `vendor/` directories from fetched packages see the `-v` flag.
    74  
    75  ## glide install
    76  
    77  When you want to install the specific versions from the `glide.lock` file use `glide install`.
    78  
    79      $ glide install
    80  
    81  This will read the `glide.lock` file, warning you if it's not tied to the `glide.yaml` file, and install the commit id specific versions there.
    82  
    83  When the `glide.lock` file doesn't tie to the `glide.yaml` file, such as there being a change, it will provide an warning. Running `glide up` will recreate the `glide.lock` file when updating the dependency tree.
    84  
    85  If no `glide.lock` file is present `glide install` will perform an `update` and generates a lock file.
    86  
    87  To remove any nested `vendor/` directories from fetched packages see the `-v` flag.
    88  
    89  ## glide novendor (aliased to nv)
    90  
    91  When you run commands like `go test ./...` it will iterate over all the subdirectories including the `vendor` directory. When you are testing your application you may want to test your application files without running all the tests of your dependencies and their dependencies. This is where the `novendor` command comes in. It lists all of the directories except `vendor`.
    92  
    93      $ go test $(glide novendor)
    94  
    95  This will run `go test` over all directories of your project except the `vendor` directory.
    96  
    97  ## glide name
    98  
    99  When you're scripting with Glide there are occasions where you need to know the name of the package you're working on. `glide name` returns the name of the package listed in the `glide.yaml` file.
   100  
   101  ## glide list
   102  
   103  Glide's `list` command shows an alphabetized list of all the packages that a project imports.
   104  
   105      $ glide list
   106      INSTALLED packages:
   107      	vendor/github.com/andrewlunde/cookoo
   108      	vendor/github.com/andrewlunde/cookoo/fmt
   109      	vendor/github.com/andrewlunde/cookoo/io
   110      	vendor/github.com/andrewlunde/cookoo/web
   111      	vendor/github.com/Masterminds/semver
   112      	vendor/github.com/Masterminds/vcs
   113      	vendor/github.com/urfave/cli
   114      	vendor/gopkg.in/yaml.v2
   115  
   116  ## glide help
   117  
   118  Print the glide help.
   119  
   120      $ glide help
   121  
   122  ## glide --version
   123  
   124  Print the version and exit.
   125  
   126      $ glide --version
   127      glide version 0.12.0
   128  
   129  ## glide mirror
   130  
   131  Mirrors provide the ability to replace a repo location with
   132  another location that's a mirror of the original. This is useful when you want
   133  to have a cache for your continuous integration (CI) system or if you want to
   134  work on a dependency in a local location.
   135  
   136  The mirrors are stored in an `mirrors.yaml` file in your `GLIDE_HOME`.
   137  
   138  The three commands to manage mirrors are `list`, `set`, and `remove`.
   139  
   140  Use `set` in the form:
   141  
   142      glide mirror set [original] [replacement]
   143  
   144  or
   145  
   146      glide mirror set [original] [replacement] --vcs [type]
   147  
   148  for example,
   149  
   150      glide mirror set https://github.com/example/foo https://git.example.com/example/foo.git
   151  
   152  or
   153  
   154      glide mirror set https://github.com/example/foo file:///path/to/local/repo --vcs git
   155  
   156  Use `remove` in the form:
   157  
   158      glide mirror remove [original]
   159  
   160  for example,
   161  
   162      glide mirror remove https://github.com/example/foo