github.com/kngu9/glide@v0.0.0-20160505135211-e73500c73591/docs/commands.md (about) 1 # Commands 2 3 The following are the Glide commands, most of which are to help yoy manage your workspace. 4 5 ## glide create (aliased to init) 6 7 Initializes a new workspace. Among other things, this creates a `glide.yaml` file while attempting to guess the packages and versions to put in it. For example, if your project is using Godep it will use the versions specified there. Glide is smart enough to scan your codebase and detect the imports being used whether they are specified with another package manager or not. 8 9 $ glide init 10 [INFO] Generating a YAML configuration file and guessing the dependencies 11 [INFO] Attempting to import from other package managers (use --skip-import to skip) 12 [INFO] Found reference to github.com/BurntSushi/toml 13 [INFO] Found reference to github.com/Masterminds/semver 14 [INFO] Found reference to github.com/Masterminds/sprig 15 [INFO] Found reference to github.com/Masterminds/vcs 16 [INFO] Found reference to github.com/aokoli/goutils 17 [INFO] Found reference to github.com/codegangsta/cli 18 [INFO] Found reference to github.com/deis/pkg/prettyprint 19 [INFO] Found reference to github.com/ghodss/yaml 20 [INFO] Found reference to github.com/google/go-github/github 21 [INFO] Found reference to github.com/pborman/uuid 22 [INFO] Found reference to golang.org/x/crypto/nacl/box 23 [INFO] Adding sub-package ssh/terminal to golang.org/x/crypto 24 [INFO] Found reference to gopkg.in/yaml.v2 25 ... 26 27 ## glide get [package name] 28 29 You can download one or more packages to your `vendor` directory and have it added to your 30 `glide.yaml` file with `glide get`. 31 32 $ glide get github.com/Masterminds/cookoo 33 34 When `glide get` is used it will introspect the listed package to resolve its dependencies including using Godep, GPM, Gom, and GB config files. 35 36 The `glide get` command can have a [version or range](versions.md) passed in with the package name. For example, 37 38 $ glide get github.com/Masterminds/cookoo#^1.2.3 39 40 The version is separated from the package name by an anchor (`#`). 41 42 ## glide update (aliased to up) 43 44 Download or update all of the libraries listed in the `glide.yaml` file and put them in the `vendor` directory. It will also recursively walk through the dependency packages doing the same thing if no `vendor` directory exists. 45 46 $ glide up 47 48 This will recurse over the packages looking for other projects managed by Glide, Godep, GB, Gom, and GPM. When one is found those packages will be installed as needed. 49 50 A `glide.lock` file will be created or updated with the dependencies pinned to specific versions. For example, if in the `glide.yaml` file a version was specified as a range (e.g., `^1.2.3`) it will be set to a specific commit id in the `glide.lock` file. That allows for reproducible installs (see `glide install`). 51 52 If you want to use `glide up` to help you managed dependencies that are checked into your version control consider the flags: 53 54 * `--update-vendored` (aliased to `-u`) to update the vendored dependencies. If Glide detects a vendored dependency it will update it and leave it in a vendored state. Note, any tertiary dependencies will not be automatically vendored with this flag. 55 * `--strip-vcs` (aliased to `-s`) to strip VCS metadata (e.g., `.git` directories) from the `vendor` folder. 56 * `--strip-vendor` (aliased to `-v`) to strip nested `vendor/` directories. 57 58 For example, you can use the command: 59 60 $ glide up -u -s 61 62 This will tell Glide to update the vendored packages and remove any VCS directories from transitive dependencies that were picked up as well. 63 64 ## glide install 65 66 When you want to install the specific versions from the `glide.lock` file use `glide install`. 67 68 $ glide install 69 70 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. 71 72 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. 73 74 If no `glide.lock` file is present `glide install` will perform an `update` and generates a lock file. 75 76 ## glide novendor (aliased to nv) 77 78 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`. 79 80 $ go test $(glide novendor) 81 82 This will run `go test` over all directories of your project except the `vendor` directory. 83 84 ## glide name 85 86 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. 87 88 ## glide list 89 90 Glide's `list` command shows an alphabetized list of all the packages that a project imports. 91 92 ``` 93 $ glide list 94 INSTALLED packages: 95 vendor/github.com/Masterminds/cookoo 96 vendor/github.com/Masterminds/cookoo/fmt 97 vendor/github.com/Masterminds/cookoo/io 98 vendor/github.com/Masterminds/cookoo/web 99 vendor/github.com/Masterminds/semver 100 vendor/github.com/Masterminds/vcs 101 vendor/github.com/codegangsta/cli 102 vendor/gopkg.in/yaml.v2 103 ``` 104 105 ## glide help 106 107 Print the glide help. 108 109 ``` 110 $ glide help 111 ``` 112 113 ## glide --version 114 115 Print the version and exit. 116 117 ``` 118 $ glide --version 119 glide version 0.9.0 120 ```