This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +93
-3
lines changed Expand file tree Collapse file tree 4 files changed +93
-3
lines changed Original file line number Diff line number Diff line change 1+ 'use strict'
2+
3+ const Command = require ( 'ronin' ) . Command
4+ const IPFS = require ( '../../../ipfs-core' )
5+ const debug = require ( 'debug' )
6+ const log = debug ( 'cli:version' )
7+ log . error = debug ( 'cli:version:error' )
8+
9+ module . exports = Command . extend ( {
10+ desc : 'Shows IPFS version information' ,
11+
12+ options : {
13+ number : {
14+ alias : 'n' ,
15+ type : 'boolean' ,
16+ default : false
17+ } ,
18+ commit : {
19+ type : 'boolean' ,
20+ default : false
21+ } ,
22+ repo : {
23+ type : 'boolean' ,
24+ default : false
25+ }
26+ } ,
27+
28+ run : ( name ) => {
29+ var node = new IPFS ( )
30+ node . version ( ( err , version ) => {
31+ if ( err ) { return log . error ( err ) }
32+
33+ console . log ( version )
34+ } )
35+ }
36+ } )
Original file line number Diff line number Diff line change 1+ 'use strict'
2+
3+ const Command = require ( 'ronin' ) . Command
4+ const IPFS = require ( '../../../ipfs-core' )
5+ const debug = require ( 'debug' )
6+ const path = require ( 'path' )
7+ const log = debug ( 'cli:version' )
8+ log . error = debug ( 'cli:version:error' )
9+
10+ module . exports = Command . extend ( {
11+ desc : 'Replaces the config with <file>' ,
12+
13+ options : { } ,
14+
15+ run : ( configPath ) => {
16+ var node = new IPFS ( )
17+ var config = require ( path . resolve ( process . cwd ( ) , configPath ) )
18+
19+ node . config . replace ( config , ( err , version ) => {
20+ if ( err ) { return log . error ( err ) }
21+
22+ console . log ( version )
23+ } )
24+ }
25+ } )
Original file line number Diff line number Diff line change 1+ 'use strict'
2+
3+ const Command = require ( 'ronin' ) . Command
4+ const IPFS = require ( '../../../ipfs-core' )
5+ const debug = require ( 'debug' )
6+ const log = debug ( 'cli:version' )
7+ log . error = debug ( 'cli:version:error' )
8+
9+ module . exports = Command . extend ( {
10+ desc : 'Outputs the content of the config file' ,
11+
12+ options : { } ,
13+
14+ run : ( ) => {
15+ var node = new IPFS ( )
16+ node . config . show ( ( err , config ) => {
17+ if ( err ) { return log . error ( err ) }
18+
19+ console . log ( JSON . stringify ( config , null , 4 ) )
20+ } )
21+ }
22+ } )
Original file line number Diff line number Diff line change @@ -75,11 +75,18 @@ describe('config', () => {
7575 } )
7676 } )
7777
78- it . skip ( 'replace' , done => {
78+ it ( 'replace' , done => {
7979 let ipfs = new IPFS ( )
80- ipfs . config ( ( err , config ) => {
80+ ipfs . config . replace ( { } , err => {
8181 expect ( err ) . to . not . exist
82- done ( )
82+ ipfs . config . show ( ( err , config ) => {
83+ expect ( err ) . to . not . exist
84+ expect ( config ) . to . deep . equal ( { } )
85+ ipfs . config . replace ( defaultConfig , err => {
86+ expect ( err ) . to . not . exist
87+ done ( )
88+ } )
89+ } )
8390 } )
8491 } )
8592
You can’t perform that action at this time.
0 commit comments