sugarjar 3.0.1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a412f3091d9ce81db841098d46c0b74f5ccf210e7f62916db5f36f68d4f9218f
4
- data.tar.gz: db6f60757390c2e8decf11cada9a423f4d61284304e9db43ef4785636f621fd3
3
+ metadata.gz: d8993339f3317f275721220d1b548fa4253180783483c4ea0d1a69080b25b6f1
4
+ data.tar.gz: 05ca92916f85edd2e1f5657aebc9e8fa50404a7ab22c973bc22bcae2bd932928
5
5
  SHA512:
6
- metadata.gz: 550d6c2792dd3b800f8fcbb3ab0d34019ba59ae09596988fc31c92452270d220c6e0a8feead9f767750f2fb529f2e0c60421a8e5756bb5c80974a7329142404b
7
- data.tar.gz: b723f16e4a2640777ebc8496afa635ff146f0a5de8e0359213aa0824e43b236a312fd199c5ddea047ff5acba604848e48ea94d9716a80ff4d280210b6dc32c83
6
+ metadata.gz: 1d1317871412a3a251cf5c5f5b456db154dc672cdbacb7475d8486ac57c8ec87ad9b5ff5daf5814bd5e9ad94b0b987f1a072c6635d713061c9d297fe0edea460
7
+ data.tar.gz: b70c9c903409db5c277752b746e6b108568434c6d95b61a7d3bb2d3fb483fc66966d14ade23bee067805212ad28d485ca928b2441d67d06b36b58468ed982e21
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # SugarJar Changelog
2
2
 
3
+ ## 4.0.0 (2026-08-09)
4
+
5
+ * Rework config file format to be more friendly to working with multiple forges
6
+ * Add `modernizeconfig` command to help users migrate to new config file format
7
+ * Various improvements to gitlab compatibility
8
+ * Fix bugs around repo name detection when directory name doesn't match
9
+ * Revamp `help` to be easier to read and navigate
10
+ * Add support for Forgejo/Codeberg forges
11
+ * Update repoconfig format to allow specifying names for checks
12
+
3
13
  ## 3.0.1 (2026-06-19)
4
14
 
5
15
  * Update tests for more resiliency in various package-building environments
data/README.md CHANGED
@@ -30,6 +30,10 @@ If you don't, there's a ton of useful stuff for everyone!
30
30
 
31
31
  Jump to what you're most interested in:
32
32
 
33
+ > [!NOTE]
34
+ > There is a new 'modernizeconfig' option to automatically convert your
35
+ > config for the significant changes in 4.x.
36
+
33
37
  * [Common Use-cases](#common-use-cases)
34
38
  * [Auto Cleanup Squash-merged branches](#auto-cleanup-squash-merged-branches)
35
39
  * [Smarter clones and remotes](#smarter-clones-and-remotes)
@@ -59,12 +63,16 @@ Jump to what you're most interested in:
59
63
 
60
64
  ### Auto cleanup squash-merged branches
61
65
 
66
+ <details>
67
+
68
+ <summary>Clean-up squash-merged PRs safely and easily</summary>
69
+
62
70
  It is common for a PR to go back and forth with a variety of nits, lint fixes,
63
71
  typos, etc. that can muddy history. So many projects will "squash and merge"
64
- when they accept a pull request. However, that means `git branch -d <branch>`
65
- doesn't work. Git will tell you the branch isn't fully merged. You can, of
66
- course `git branch -D <branch>`, but that does no safety checks at all, it
67
- forces the deletion.
72
+ when they accept a pull request. However, that means `git branch -d
73
+ BRANCH` doesn't work. Git will tell you the branch isn't fully merged.
74
+ You can, of course `git branch -D BRANCH`, but that does no safety
75
+ checks at all, it forces the deletion.
68
76
 
69
77
  Enter `sj lbclean` - it determines if the contents of your branch has been merge
70
78
  and safely deletes if so. (Note: `lbclean` stands for "local branch clean", and
@@ -78,7 +86,7 @@ https://github.com/jaymzh/sugarjar/blob/main/images/bclean.png
78
86
  Will delete a branch, if it has been merged, **even if it was squash-merged**.
79
87
 
80
88
  You can pass it a branch if you'd like (it defaults to the branch you're on):
81
- `sj bclean <branch>`.
89
+ `sj bclean BRANCH`.
82
90
 
83
91
  But it gets better! You can use `sj bcleanall` to remove all branches that have
84
92
  been merged:
@@ -100,9 +108,14 @@ There is even `sj gbclean` ("global branch clean") (and `sj gbcleanall`) which
100
108
  will do both the local and remote cleaning.
101
109
 
102
110
  *NOTE*: Remote branch cleaning is still experimental, use with caution!
111
+ </details>
103
112
 
104
113
  ### Smarter clones and remotes
105
114
 
115
+ <details>
116
+
117
+ <summary>Fork, clone, and add the upstream remote automatically</summary>
118
+
106
119
  There's a pattern to every new repo we want to contribute to. First we fork,
107
120
  then we clone the fork, then we add a remote of the upstream repo. It's
108
121
  monotonous. SugarJar does this for you:
@@ -120,18 +133,35 @@ This will:
120
133
  * Clone your fork
121
134
  * Add the original as an 'upstream' remote
122
135
 
123
- Note that it takes short names for repos. No need to specify a full URL,
124
- just a $org/$repo.
136
+ Note that if you pass in a full-formed URL (like
137
+ `git@github.com:chef/omnibus-toolchain.git`), SugarJar will infer the host and
138
+ the forge type (gitub, gitlab, etc.). However, it does accept short names for
139
+ repos ($org/$repo) - however, for cloning, since there is no repo yet for
140
+ SugarJar to determine the forge from, you will need either to specify
141
+ `--default-forge-host`, or have `default_forge_host` set in your config file.
125
142
 
126
143
  Like `git clone`, `sj smartclone` will accept an additional argument as the
127
144
  destination directory to clone to. It will also pass any other unknown options
128
145
  to `git clone` under the hood.
129
146
 
130
147
  If you don't work with fork-based workflows, you can set `use_forks: false`
131
- in your config, or pass in `--no-use-forks` to `sj sclone`.
148
+ in your config for the right host:
149
+
150
+ ```yaml
151
+ host_configs:
152
+ default:
153
+ use_forks: false
154
+ ```
155
+
156
+ See [Configuration](#Configuration) for more details on the config file.
157
+ </details>
132
158
 
133
159
  ### Work with stacked branches more easily
134
160
 
161
+ <details>
162
+
163
+ <summary>Create and manage stacked/dependent branches easily</summary>
164
+
135
165
  It's important to break changes into reviewable chunks, but working with
136
166
  stacked branches can be confusing. SugarJar provides several tools to make this
137
167
  easier.
@@ -227,9 +257,14 @@ https://github.com/jaymzh/sugarjar/blob/main/images/subfeature-detect-missing-ba
227
257
 
228
258
  SugarJar detects that branch is gone and thus this branch should now be based
229
259
  on the upstream main branch!
260
+ </details>
230
261
 
231
262
  ### Creating Stacked PRs with subfeatures
232
263
 
264
+ <details>
265
+
266
+ <summary>Automatically base PRs for subfeatures on their parent branch</summary>
267
+
233
268
  When dependent branches are created with `subfeature`, when you create a PR,
234
269
  SugarJar will automatically set the 'base' of the PR to the parent branch. By
235
270
  default it'll prompt you about this, but you can set `pr_autostack` to `true`
@@ -242,8 +277,14 @@ It looks like this is a subfeature, would you like to base this PR on mynewthing
242
277
  ...
243
278
  ```
244
279
 
280
+ </details>
281
+
245
282
  ### Smart release branch handling
246
283
 
284
+ <details>
285
+
286
+ <summary>Configure and protect long-lived release branches</summary>
287
+
247
288
  You can tell sugar what release branches exist, and it will intelligently
248
289
  handle them. So of you specify, in your repoconfig:
249
290
 
@@ -259,9 +300,14 @@ Then:
259
300
  to `upstream/v2-branch` (or `origin/v2-branch` as appropriate)
260
301
  * `sj lbclean`/`sj lbcleanall` (of all varieties) will never reap release
261
302
  branches
303
+ </details>
262
304
 
263
305
  ### Have a better lint/unittest experience!
264
306
 
307
+ <details>
308
+
309
+ <summary>Run lint and unittests automatically before pushing</summary>
310
+
265
311
  Ever made a PR, only to find out later that it failed tests because of some
266
312
  small lint issue? Not anymore! SJ can be configured to run things before
267
313
  pushing. For example,in the SugarJar repo, we have it run Rubocop (ruby lint)
@@ -290,15 +336,25 @@ sj smartpush # or spush
290
336
 
291
337
  Run configured push-time actions (nothing, lint, unit, both), and do not
292
338
  push if any of them fail.
339
+ </details>
293
340
 
294
341
  ### Better push defaults
295
342
 
343
+ <details>
344
+
345
+ <summary>Smart defaults for `smartpush`</summary>
346
+
296
347
  In addition to running pre-push tests for you `smartpush` also picks smart
297
348
  defaults for push. So if you `sj spush` with no arguments, it uses the
298
349
  `origin` remote and the same branch name you're on as the remote branch.
350
+ </details>
299
351
 
300
352
  ### Cleaning up your own history
301
353
 
354
+ <details>
355
+
356
+ <summary>Safely amend commits and force-push with `amend`/`fpush`</summary>
357
+
302
358
  Perhaps you contribute to a project that prefers to use merge commits, so you
303
359
  like to clean up your own history. This is often difficult to get right - a
304
360
  combination of rebases, amends and force pushes. We provide two commands here
@@ -316,9 +372,14 @@ sure you're up-to-date with the remote before forcing the push. But man that
316
372
  command is a mouthful! Enter `sj fpush`. It has all the smarts of `sj
317
373
  smartpush` (runs configured pre-push actions), but adds `--force-with-lease` to
318
374
  the command!
375
+ </details>
319
376
 
320
377
  ### Better feature branches
321
378
 
379
+ <details>
380
+
381
+ <summary>Create feature branches with the right base and prefix</summary>
382
+
322
383
  When you want to start a new feature, you want to start developing against
323
384
  latest. That's why `sj feature` defaults to creating a branch against what we
324
385
  call "most master". That is, `upstream/master` if it exists, otherwise
@@ -347,17 +408,36 @@ e.g. `$USER/`.
347
408
  For example, if your prefix was `user/`, then `sj feature foo` would create
348
409
  `user/foo`, and `sj co foo` would switch to `user/foo`.
349
410
 
411
+ Here's an example:
412
+
413
+ ```yaml
414
+ host_configs:
415
+ default:
416
+ feature_prefix: "jsmith/"
417
+ ```
418
+
419
+ </details>
420
+
350
421
  ### Smartlog
351
422
 
423
+ <details>
424
+
425
+ <summary>Visualize your branch tree</summary>
426
+
352
427
  Smartlog will show you a tree diagram of your branches! Simply run `sj
353
428
  smartlog` or `sj sl` for short.
354
429
 
355
430
  ![smartlog screenshot](
356
431
  https://github.com/jaymzh/sugarjar/blob/main/images/smartlog.png
357
432
  )
433
+ </details>
358
434
 
359
435
  ### Sync work across workstations
360
436
 
437
+ <details>
438
+
439
+ <summary>Keep branches in sync across multiple machines</summary>
440
+
361
441
  If you work on multiple workstations, keeping your branches in-sync can be a
362
442
  pain. SugarJar provides `sync` to help with this.
363
443
 
@@ -370,19 +450,50 @@ from `origin/foo`. If you have local changes, that are not already on
370
450
 
371
451
  It's very similar to `sj up`, but instead of rebasing on top of the tracking
372
452
  branch, it rebases on top of the push target branch.
453
+ </details>
373
454
 
374
455
  ### Pulling in suggestions from the web
375
456
 
457
+ <details>
458
+
459
+ <summary>Merge in GitHub/GitLab suggested changes</summary>
460
+
376
461
  When someone 'suggests' a change in the GH/GL WebUI, once you choose to commit
377
462
  them, your origin and local branches are no longer in-sync. The
378
463
  `pullsuggestions` command will attempt to merge in any remote commits to your
379
464
  local branch. This command will show a diff and ask for confirmation before
380
465
  attempting the merge and - if allowed to continue - will use a fast-forward
381
466
  merge.
467
+ </details>
468
+
469
+ ### Modernize your config
470
+
471
+ <details>
472
+
473
+ <summary>Convert your old config to the new `host_configs` format</summary>
474
+
475
+ In 4.0, we significantly revamped how the configuration works, adding the new
476
+ `host_configs` section, and deprecating or moving many top-level configs. In
477
+ order to make this transition easier, there is now a `modernizeconfig` command
478
+ to convert it for you!
479
+
480
+ ```shell
481
+ sj modernizeconfig ~/.config/sugarjar/config.yml
482
+ ```
483
+
484
+ This will generate a new config for you, show you a diff, and offer to either
485
+ update the existing file, or save it off the side for you.
486
+
487
+ </details>
382
488
 
383
489
  ### And more!
384
490
 
491
+ <details>
492
+
493
+ <summary>There's even more than this!</summary>
494
+
385
495
  See `sj help` for more commands!
496
+ </details>
386
497
 
387
498
  ## Installation
388
499
 
@@ -454,24 +565,18 @@ prone, so this setting will automatically set this up for each developer.
454
565
  Like `gh` and `glab`, SugarJar supports Enterprise versions of GitHub and
455
566
  GitLab. In fact, we provide extra features just for it.
456
567
 
457
- In most cases, when using `sj smartclone`, pass in `--forge-host`, and
458
- that's about all you need, everything else should be handlded automagically.
459
-
460
- However, you can set `forge_host` in your global or user config, but since most
461
- users will also have a few opensource repos, you can override it in the
462
- Repository Config as well.
568
+ By default, SugarJar will pick up the appropriate information from the repo
569
+ itself, so the only real interesting part is `smartclone`. In most cases,
570
+ SugarJar will automatically determine the proper forge-host based on the URL
571
+ you pass in. However, if you use short names ("repo/org" or
572
+ "company/repo/org"), then you can either pass in `--default-forge-host`, or, if
573
+ you want to always default to a given host, you can set a top-level
574
+ `default_forge_host` in your SugarJar config:
463
575
 
464
576
  So, for example you might have:
465
577
 
466
578
  ```yaml
467
- forge_host: gh.sample.com
468
- ```
469
-
470
- In your `~/.config/sugarjar/config.yaml`, but if the `.sugarjar.yaml` in your
471
- repo has:
472
-
473
- ```yaml
474
- forge_host: github.com
579
+ default_forge_host: gh.sample.com
475
580
  ```
476
581
 
477
582
  ## FAQ
data/bin/sj CHANGED
@@ -5,6 +5,7 @@ require 'optparse'
5
5
  require 'mixlib/shellout'
6
6
  require_relative '../lib/sugarjar/commands'
7
7
  require_relative '../lib/sugarjar/config'
8
+ require_relative '../lib/sugarjar/help'
8
9
  require_relative '../lib/sugarjar/log'
9
10
  require_relative '../lib/sugarjar/util'
10
11
  require_relative '../lib/sugarjar/version'
@@ -23,6 +24,7 @@ if ENV['SUGARJAR_LOGLEVEL']
23
24
  options['log_level'] = SugarJar::Log.level = ENV['SUGARJAR_LOGLEVEL'].to_sym
24
25
  end
25
26
 
27
+ options['_cli_overrides'] = {}
26
28
  parser = OptionParser.new do |opts|
27
29
  opts.banner = 'Usage: sj <command> [<args>] [<options>]'
28
30
 
@@ -31,39 +33,39 @@ parser = OptionParser.new do |opts|
31
33
  opts.separator ''
32
34
  opts.separator 'OPTIONS:'
33
35
 
34
- opts.on('--feature-prefix', 'Prefix to use for feature branches') do |prefix|
35
- options['feature_prefix'] = prefix
36
- end
37
-
38
36
  opts.on(
39
- '--forge-host HOST',
40
- '--github-host HOST',
41
- 'The host of your forge (github, gitlab, etc.). Generally only needed' +
42
- ' when cloning (smartclone), as we can usually figure out from within' +
43
- ' a cloned repo. Currently accepts --github-host for backwards' +
44
- ' compatibility.',
37
+ '--default-forge-host HOST',
38
+ 'The default host of your forge (github, gitlab, etc.) when it cannot ' +
39
+ 'be determined automatically. In nearly every case SJ will ' +
40
+ 'automatically determine this. However, for `smartclone`, if ' +
41
+ 'you use shortnames (e.g. org/repo) that do not contain a host, this ' +
42
+ 'is the default to assume. Most useful in your config file when set ' +
43
+ 'to your most comomn forge host (e.g. github.com)',
45
44
  ) do |host|
46
- options['forge_host'] = host
45
+ options['default_forge_host'] = host
47
46
  end
48
47
 
49
- opts.on('--forge-type TYPE', 'Forge type: github, gitlab') do |type|
50
- options['forge_type'] = type
48
+ opts.on(
49
+ '--feature-prefix PREFIX',
50
+ 'Bypass the config and just use PREFIX.',
51
+ ) do |prefix|
52
+ options['_cli_overrides']['feature_prefix'] = prefix
51
53
  end
52
54
 
53
55
  opts.on(
54
- '--github-user USER',
55
- 'User for github repos, unless specified in the repoconfig.' +
56
- ' Defaults to your local username',
57
- ) do |user|
58
- options['github_user'] = user
56
+ '--forge-type TYPE',
57
+ 'GENERALLY NOT NEEDED. In case SJ cannot detect the type of a forge ' +
58
+ 'from the hostname during smartclone. Only available in CLI, not a ' +
59
+ 'config file option. Forge type: github, gitlab.',
60
+ ) do |type|
61
+ options['_cli_overrides']['forge_type'] = type
59
62
  end
60
63
 
61
64
  opts.on(
62
- '--gitlab-user USER',
63
- 'User for gitlab repos, unless specified in the repoconfig.' +
64
- ' Defaults to your local username',
65
+ '--forge-user USER',
66
+ 'Bypass the config and just use USER as the forge user.',
65
67
  ) do |user|
66
- options['gitlab_user'] = user
68
+ options['_cli_overrides']['user'] = user
67
69
  end
68
70
 
69
71
  opts.on('-h', '--help', 'Print this help message') do
@@ -103,14 +105,6 @@ parser = OptionParser.new do |opts|
103
105
  options['pr_autofill'] = autofill
104
106
  end
105
107
 
106
- opts.on(
107
- '--[no-]use-forks',
108
- 'Create (add a remote for) forks, when the organization does not match ' +
109
- 'the user. [default: true]',
110
- ) do |val|
111
- options['use_forks'] = val
112
- end
113
-
114
108
  opts.on(
115
109
  '--fork-name NAME',
116
110
  'When forking a repo (in `smartclone`), fork the repo to a different ' +
@@ -138,186 +132,11 @@ parser = OptionParser.new do |opts|
138
132
  exit
139
133
  end
140
134
 
141
- # rubocop:disable Layout/HeredocIndentation
142
- opts.separator <<COMMANDTEXT
143
-
144
- COMMANDS:
145
- amend
146
- Amend the current commit. Alias for "git commit --amend".
147
- Accepts other arguments such as "-a" or files.
148
-
149
- amendq, qamend
150
- Same as "amend" but without changing the message. Alias for
151
- "git commit --amend --no-edit".
152
-
153
- binfo
154
- Verbose information about the current branch.
155
-
156
- br
157
- Verbose branch list. An alias for "git branch -v".
158
-
159
- debuginfo
160
- Prints out a bunch of version and config information useful for
161
- including in bug reports.
162
-
163
- feature, f <branch_name>
164
- Create a "feature" branch. It's morally equivalent to
165
- "git checkout -b" except it defaults to creating it based on
166
- some form of 'master' instead of your current branch. In order
167
- of preference it will be upstream/master, origin/master, master,
168
- depending upon what remotes are available.
169
-
170
- Note that you can specify "--feature-prefix" (or add
171
- "feature_prefix" to your config) to have all features created
172
- with a prefix. This is useful for branch-based workflows where
173
- developers are expected to create branches names that, for
174
- example, start with their username.
175
-
176
- forcepush, fpush
177
- The same as "smartpush", but uses "--force-with-lease". This is
178
- a "safer" way of doing force-pushes and is the recommended way
179
- to push after rebasing or amending. Never do this to shared
180
- branches. Very convenient for keeping the branch behind a pull-
181
- request clean.
182
-
183
- forcesync, fsync
184
- See 'sync' below, but never tries to rebase, always does a
185
- hard reset.
186
-
187
- globalbranchclean, gbclean [<branch>] [<remote>]
188
- WARNING: EXPERIMENTAL COMMAND.
189
-
190
- Combination of "lbclean" and "rbclean". Cleans up
191
- both local and remote branches safely. See those commands for
192
- details.
193
-
194
- globalbranchcleanall, gbcleanall [<remote>]
195
- WARNING: EXPERIMENTAL COMMAND.
196
-
197
- Safely clean all branches, both local and remote. See "gbclean"
198
- for details.
199
-
200
- lint
201
- Run any linters configured in .sugarjar.yaml.
202
-
203
- localbranchclean, lbclean [<branch>]
204
- If safe, delete the current branch (or the specified branch).
205
- Unlike "git branch -d", lbclean can handle squash-merged branches.
206
- Think of it as a smarter "git branch -d".
207
-
208
- Aliased to 'bclean' for backwards compatibility.
209
-
210
- localbranchcleanall, lbcleanall
211
- Walk all branches, and try to delete them if it's safe. See
212
- "lbclean" for details.
213
-
214
- Aliased to 'bcleanall' for backwards compatibility.
215
-
216
- pullsuggestions, ps
217
- Pull any suggestions *that have been committed* in the GitHub UI.
218
- This will show the diff and prompt for confirmation before
219
- merging. Note that a fast-forward merge will be used.
220
-
221
- remotebranchclean, rbclean [<branch>] [<remote>]
222
- WARNING: EXPERIMENTAL COMMAND.
223
-
224
- Similar to lbclean, except safely cleans up remote branches.
225
- Unlike many git commands, <remote> comes after <branch> so
226
- that you can specify a branch and the remote defaults to 'origin'.
227
- This means you can do "sj rclean" to clean the remote branch with
228
- the same name as the local one. Note that you probably want
229
- "sclean", which will do both local and remote cleaning in one
230
- command.
231
-
232
- WARNING: This command cannot differentiate release branches
233
- that are fully merged but still need to be kept around for future
234
- work. So if main contains everything that 2.0-devel and 3.0-devel
235
- has, then those branches will be deleted. Use with caution.
236
-
237
- remotebranchcleanall, rbcleanall [<remote>]
238
- WARNING: EXPERIMENTAL COMMAND.
239
-
240
- Walk all remote branches, and try to delete them if it's safe. See
241
- "rbclean" for details.
242
-
243
- smartclone, sclone <repo> [<dir>]
244
- A smart wrapper to "git clone" that handles forking and managing
245
- remotes for you.
246
-
247
- If the org of the repository is not the same as your forge user
248
- then it will fork the repo for you to your account (if not
249
- already done), clone the repo, and then setup your remotes
250
- so that "origin" is your fork and "upstream" is the upstream.
251
-
252
- It is assumed that there will be at least one positional
253
- argument, and it will be the repo in any format (git, ssh,
254
- forge-style shortname [e.g. e.g. "$org/$repo"]). A second
255
- positional argument will be interpreted as the directory to
256
- clone into.
257
-
258
- If you want to change the name of the repo in your fork of it,
259
- you may pass in --fork-name to specify another.
260
-
261
- Note that if you pass in additional options after ' -- ', they
262
- will be passed to 'gh' in the case of GitHub, or 'git' in the
263
- case of GitLab.
264
-
265
- For example to clone foo/bar/docs on gitlab, but have the
266
- repo named 'bar-docs' when it's cloned to your org, and to
267
- have the directory be called 'bar-docs':
268
-
269
- sj sclone foo/bar/docs bar-docs \
270
- --forge-type glab --fork-name bar-docs
271
-
272
- Or for GitHub:
273
-
274
- sj sclone bar/docs bar-docs \
275
- --forge-type github --fork-name bar-docs
276
-
277
- smartlog, sl
278
- Inspired by Facebook's "sl" extension to Mercurial, this command
279
- will show you a tree of all your local branches relative to your
280
- upstream.
281
-
282
- smartpullrequest, smartpr, spr
283
- A smart wrapper to "hub pull-request" that checks if your repo
284
- is dirty before creating the pull request.
285
-
286
- smartpush, spush
287
- A smart wrapper to "git push" that runs whatever is defined in
288
- "on_push" in .sugarjar.yml, and only pushes if they succeed.
289
-
290
- subfeature, sf <feature>
291
- An alias for 'sj feature <feature> <current_branch>'
292
-
293
- sync
294
- Similar to `up`, except instead of rebasing on a tracked branch
295
- (usually `upstream` remote), rebases to wherever our remote push
296
- target is (usually `origin` remote). Useful for syncing work
297
- across different machines.
298
-
299
- For example, if you do some work on feature `foo` on machine1 and
300
- push to `origin/foo` (intending to eventually merge to
301
- `upstream/main`), then on machine2, you pull that branch, do more
302
- work, which you also push to `origin/foo`, then on machine1, you
303
- can do `sj sync` to pull down the changes from `origin/foo`. If
304
- you have local changes, that are not already on `origin/foo`,
305
- those will be rebased on top of the changes from `origin/foo`.
306
-
307
- unit
308
- Run any unitests configured in .sugarjar.yaml.
309
-
310
- up [<branch>]
311
- Rebase the current branch (or specified branch) intelligently.
312
- In most causes this will check for a main (or master) branch on
313
- upstream, then origin. If a branch explicitly tracks something
314
- else, then that will be used, instead.
315
-
316
- upall
317
- Same as "up", but for all branches.
318
- COMMANDTEXT
319
-
320
- # rubocop:enable Layout/HeredocIndentation
135
+ opts.separator ''
136
+ opts.separator 'COMMANDS:'
137
+ opts.separator SugarJar::Help.summary_list
138
+ opts.separator ''
139
+ opts.separator "Run 'sj help <command>' for details on a specific command."
321
140
  end
322
141
 
323
142
  extra_opts = []
@@ -369,7 +188,18 @@ SugarJar::Log.debug("Final config: #{options}")
369
188
 
370
189
  # if the command is help, we don't bother to create the Commands obj
371
190
  if subcommand == 'help'
372
- puts parser
191
+ help_target = argv_copy.reject { |x| x.start_with?('-') }[1]
192
+ if help_target
193
+ help_text = SugarJar::Help.command_help(help_target)
194
+ if help_text
195
+ puts help_text
196
+ else
197
+ SugarJar::Log.fatal("No such subcommand: #{help_target}")
198
+ exit 1
199
+ end
200
+ else
201
+ puts parser
202
+ end
373
203
  exit
374
204
  end
375
205
 
@@ -23,8 +23,14 @@ pr_autostack: true
23
23
  # list
24
24
  ignore_deprecated_options: [ 'gh_cli' ]
25
25
 
26
- # User to use when cloning new github repos
27
- github_user: c00ldude
28
-
29
- # User to use when cloning new gitlab repos
30
- gitlab_user: c00ldude
26
+ host_configs:
27
+ default:
28
+ use_forks: true
29
+ github.com:
30
+ user: c00ldude
31
+ gitlab.com:
32
+ user: thisc00ldude
33
+ gitlab.company.com:
34
+ user: tsmith
35
+ use_forks: false
36
+ feature_prefix: "tsmith/"