Skip to content

Commit 74fb730

Browse files
authored
Make pub add source descriptor compatible with powershell (#6494)
1 parent 8e280c9 commit 74fb730

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/content/tools/pub/cmd/pub-add.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,24 +103,25 @@ $ dart pub add [options] [{dev|override}:]<package>[:descriptor] [[{dev|override
103103
```
104104

105105
The syntax reflects how dependencies are written in `pubspec.yaml`.
106+
Follow the same format including spaces.
106107

107108
```plaintext
108-
'<package>:{"<source>":"<descriptor>"[,"<source>":"<descriptor>"],"version":"<constraint>"}'
109+
"<package>:{<source>: <descriptor>[, <source>: <descriptor>], version: <constraint>}"
109110
```
110111

111112
### `git`
112113

113114
Adds a [git dependency](/tools/pub/dependencies#git-packages).
114115

115116
```console
116-
$ dart pub add 'foo:{"git":"https://github.com/foo/foo"}'
117+
$ dart pub add "foo:{git: https://github.com/foo/foo}"
117118
```
118119

119120
You can specify the repository, and the branch or commit, or exact location,
120121
within that repository:
121122

122123
```console
123-
$ dart pub add 'foo:{"git":{"url":"../foo.git","ref":"branch","path":"subdir"}}'
124+
$ dart pub add "foo:{git:{url: ../foo.git, ref: branch, path: subdir}}"
124125
```
125126

126127
#### `url`
@@ -155,7 +156,7 @@ Adds a [hosted dependency][] that depends on
155156
the package server at the specified URL.
156157

157158
```console
158-
$ dart pub add 'foo:{"hosted":"my-pub.dev"}'
159+
$ dart pub add "foo:{hosted: my-pub.dev}"
159160
```
160161

161162
_Previously the `--hosted-url=<package_server_url>` option_.
@@ -167,7 +168,7 @@ _Previously the `--hosted-url=<package_server_url>` option_.
167168
Adds a [path dependency][] on a locally stored package.
168169

169170
```console
170-
$ dart pub add 'foo:{"path":"../foo"}'
171+
$ dart pub add "foo:{path: ../foo}"
171172
```
172173

173174
_Previously the `--path=<directory_path>` option_.
@@ -179,7 +180,7 @@ _Previously the `--path=<directory_path>` option_.
179180
Adds a package from the specified SDK source.
180181

181182
```console
182-
$ dart pub add 'foo:{"sdk":"flutter"}'
183+
$ dart pub add "foo:{sdk: flutter}"
183184
```
184185

185186
_Previously the `--sdk=<sdk_name>` option_:

0 commit comments

Comments
 (0)