File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ const CLI = require ( '../../lib/cli' ) ;
4+ const { runPromise } = require ( '../../lib/run' ) ;
5+ const SyncSession = require ( '../../lib/sync_session' ) ;
6+
7+ function builder ( yargs ) {
8+ return yargs
9+ . wrap ( 90 ) ;
10+ }
11+
12+ async function main ( ) {
13+ const logStream = process . stdout . isTTY ? process . stdout : process . stderr ;
14+ const cli = new CLI ( logStream ) ;
15+ const dir = process . cwd ( ) ;
16+ const session = new SyncSession ( cli , dir ) ;
17+ await session . sync ( ) ;
18+ }
19+
20+ function handler ( argv ) {
21+ return runPromise ( main ( ) ) ;
22+ }
23+
24+ module . exports = {
25+ command : 'sync' ,
26+ describe : 'Sync the branch specified by ncu-config' ,
27+ builder,
28+ handler
29+ } ;
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ const Session = require ( './session' ) ;
4+
5+ class SyncSession extends Session {
6+ constructor ( cli , dir ) {
7+ // eslint-disable-next-line no-useless-constructor
8+ super ( cli , dir ) ;
9+ }
10+
11+ async sync ( ) {
12+ if ( this . warnForMissing ( ) ) {
13+ return ;
14+ }
15+ if ( this . warnForWrongBranch ( ) ) {
16+ return ;
17+ }
18+ return this . tryResetHead ( ) ;
19+ }
20+ }
21+
22+ module . exports = SyncSession ;
You can’t perform that action at this time.
0 commit comments