mirror of
https://github.com/zhigang1992/firebase-tools.git
synced 2026-04-29 12:25:21 +08:00
sub pages for help docs
This commit is contained in:
83
bin/firebase
83
bin/firebase
@@ -11,7 +11,8 @@ var argv = require('optimist')
|
||||
.argv,
|
||||
prompt = require('prompt'),
|
||||
firebase = require('../lib/firebase'),
|
||||
app = require('../lib/app');
|
||||
app = require('../lib/app'),
|
||||
help = require('../lib/help');
|
||||
|
||||
prompt.override = argv;
|
||||
prompt.message = '';
|
||||
@@ -21,51 +22,59 @@ prompt.colors = false;
|
||||
if (argv._.length === 0) {
|
||||
|
||||
if (argv.version) {
|
||||
firebase.showVersion();
|
||||
help.showVersion();
|
||||
} else {
|
||||
firebase.showHelp();
|
||||
help.showHelp();
|
||||
}
|
||||
|
||||
} else {
|
||||
// Top-level router
|
||||
switch (argv._[0]) {
|
||||
if (argv.help) {
|
||||
|
||||
// Top-level functionality
|
||||
help.showHelp(argv._[0]);
|
||||
|
||||
case 'login':
|
||||
firebase.login();
|
||||
break;
|
||||
case 'logout':
|
||||
firebase.logout(argv.d);
|
||||
break;
|
||||
case 'ls':
|
||||
case 'list':
|
||||
firebase.list();
|
||||
break;
|
||||
} else {
|
||||
// Top-level router
|
||||
switch (argv._[0]) {
|
||||
|
||||
// Submodules
|
||||
// Top-level functionality
|
||||
|
||||
case 'init':
|
||||
case 'initialise':
|
||||
case 'initialize':
|
||||
app.init(argv);
|
||||
break;
|
||||
case 'bootstrap':
|
||||
app.bootstrap(argv);
|
||||
break;
|
||||
case 'deploy':
|
||||
app.deploy();
|
||||
break;
|
||||
case 'login':
|
||||
firebase.login();
|
||||
break;
|
||||
case 'logout':
|
||||
firebase.logout(argv.d);
|
||||
break;
|
||||
case 'ls':
|
||||
case 'list':
|
||||
firebase.list();
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
case 'hel':
|
||||
case 'hep':
|
||||
case 'hepl':
|
||||
case 'help':
|
||||
firebase.showHelp();
|
||||
break;
|
||||
// Submodules
|
||||
|
||||
default:
|
||||
firebase.showCommandError();
|
||||
case 'init':
|
||||
case 'initialise':
|
||||
case 'initialize':
|
||||
app.init(argv);
|
||||
break;
|
||||
case 'bootstrap':
|
||||
app.bootstrap(argv);
|
||||
break;
|
||||
case 'deploy':
|
||||
app.deploy();
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
case 'hel':
|
||||
case 'hep':
|
||||
case 'hepl':
|
||||
case 'help':
|
||||
help.showHelp();
|
||||
break;
|
||||
|
||||
default:
|
||||
console.log('\n' +
|
||||
'Command not found. Use `firebase --help` for a list of commands or\n' +
|
||||
'`firebase <command> --help` for more details\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,58 +37,6 @@ var Firebase = {
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
showHelp: function() {
|
||||
this.showVersion();
|
||||
console.log('Usage: firebase <command>\n' +
|
||||
'\n' +
|
||||
' Available commands are:\n' +
|
||||
'\n' +
|
||||
' login\n' +
|
||||
' Authenticates with the Firebase servers and stores an access token locally.\n' +
|
||||
' All commands that require authentication use this if no valid access token\n' +
|
||||
' exists.\n' +
|
||||
' --email The email address of the account to attempt to log in with.\n' +
|
||||
' --password The password of the account to attempt to log in with.\n' +
|
||||
'\n' +
|
||||
' logout\n' +
|
||||
' Invalidates and destroys any locally stored access tokens.\n' +
|
||||
' -d Optional flag to delete the settings file.\n' +
|
||||
'\n' +
|
||||
' list\n' +
|
||||
' Lists the Firebases available to the currently logged in user.\n' +
|
||||
'\n' +
|
||||
' app init\n' +
|
||||
' Initializes a Firebase app in the current directory.\n' +
|
||||
' -f, --firebase The name of the Firebase to initialize the app with.\n' +
|
||||
' -p, --public A directory containing all of the app\'s static files that\n' +
|
||||
' should deployed to Firebase Hosting. Defaults to the current\n' +
|
||||
' directory.\n' +
|
||||
' -r, --rules An optional file that contains security rules for the\n' +
|
||||
' Firebase.\n' +
|
||||
'\n' +
|
||||
' app bootstrap\n' +
|
||||
' Creates a new Firebase app from a number of predetermined templates to\n' +
|
||||
' quickly get a project up and running. Creates a new folder named after the\n' +
|
||||
' Firebase it is initialized with.\n' +
|
||||
' -f, --firebase The name of the Firebase to initialize the app with.\n' +
|
||||
' -t, --template The name of the template to initialize the app with.\n' +
|
||||
'\n' +
|
||||
' app deploy\n' +
|
||||
' Publishes the app in the current directory to Firebase Hosting. If a file\n' +
|
||||
' containing the security rules has been provided, these are uploaded to the\n' +
|
||||
' server.\n');
|
||||
},
|
||||
showVersion: function() {
|
||||
console.log('\n' +
|
||||
'Firebase Command Line Tools\n' +
|
||||
'Version ' + this.version + '\n' +
|
||||
'https://www.firebase.com\n');
|
||||
},
|
||||
showCommandError: function() {
|
||||
console.log('\n' +
|
||||
'Command not found. Use `firebase --help` for a list of commands or\n' +
|
||||
'`firebase <command> --help` for more details\n');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
75
lib/help.js
Normal file
75
lib/help.js
Normal file
@@ -0,0 +1,75 @@
|
||||
module.exports = {
|
||||
showHelp: function(command) {
|
||||
switch (command) {
|
||||
|
||||
// Top-level functionality
|
||||
|
||||
case 'login':
|
||||
console.log('login');
|
||||
break;
|
||||
case 'logout':
|
||||
console.log('logout');
|
||||
break;
|
||||
case 'ls':
|
||||
case 'list':
|
||||
console.log('list');
|
||||
break;
|
||||
|
||||
// Submodules
|
||||
|
||||
case 'init':
|
||||
case 'initialise':
|
||||
case 'initialize':
|
||||
console.log('init');
|
||||
break;
|
||||
case 'bootstrap':
|
||||
console.log('bootstrap');
|
||||
break;
|
||||
case 'deploy':
|
||||
console.log('deploy');
|
||||
break;
|
||||
|
||||
default:
|
||||
this.showVersion();
|
||||
console.log('Usage: firebase <command>\n' +
|
||||
'\n' +
|
||||
' Available commands are:\n' +
|
||||
'\n' +
|
||||
' bootstrap\n' +
|
||||
' Creates a new Firebase powered app from a number of prebuild templates to\n' +
|
||||
' quickly get a project up and running. This creates a new folder and prompts\n' +
|
||||
' you through all the required settings.\n' +
|
||||
'\n' +
|
||||
' deploy\n' +
|
||||
' Deploys the current app to Firebase Hosting and creates your subdomain on\n' +
|
||||
' firebaseapp.com if it doesn\'t exist already.\n' +
|
||||
'\n' +
|
||||
' init\n' +
|
||||
' Initializes an existing Firebase app in the current directory and prompts\n' +
|
||||
' you through configuring it for firebaseapp.com.\n' +
|
||||
'\n' +
|
||||
' list\n' +
|
||||
' Lists the Firebases available to the currently logged in user.\n' +
|
||||
'\n' +
|
||||
' login\n' +
|
||||
' Logs you into Firebase. All commands that require login will prompt\n' +
|
||||
' you if you\'re not currently logged in.\n' +
|
||||
'\n' +
|
||||
' logout\n' +
|
||||
' Logs you out of Firebase.\n' +
|
||||
'\n' +
|
||||
' -h, --help\n' +
|
||||
' Shows this help screen. Use `firebase <command> --help` for more detailed\n' +
|
||||
' help instructions.\n' +
|
||||
'\n' +
|
||||
' -v, --version\n' +
|
||||
' Displays the current version.\n');
|
||||
}
|
||||
},
|
||||
showVersion: function() {
|
||||
console.log('\n' +
|
||||
'Firebase Command Line Tools\n' +
|
||||
'Version ' + this.version + '\n' +
|
||||
'https://www.firebase.com\n');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user