Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:prompt-google-form examples added #248

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: Google form examples
  • Loading branch information
adityavyas611 committed Jan 15, 2020
commit b907d5dfa5f9d2c7be55d636fa5b67535c12cb92
5 changes: 5 additions & 0 deletions examples/googleform/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = {
FORM_ID: '1FAIpQLSdniaX5nAjywbvnT9tQp1OTryh7148Lkl5LnvJV1mBOy1QXdA'
};
27 changes: 15 additions & 12 deletions examples/googleform/enquirer.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
const Enquirer = require("enquirer");
const GoogleFormPrompt = require("prompt-google-form");
'use strict';

const Enquirer = require('enquirer');
const GoogleFormPrompt = require('..');
adityavyas611 marked this conversation as resolved.
Show resolved Hide resolved
const { FORM_ID } = require('./constants');

const enquirer = new Enquirer();
enquirer.register("google", GoogleFormPrompt);
enquirer.register('google', GoogleFormPrompt);

enquirer
.prompt([
{
type: "confirm",
name: "confirm",
message: "Would you like fill out our Survey?"
type: 'confirm',
name: 'confirm',
message: 'Would you like fill out our Survey?'
},
{
name: "Google Form",
message: "Please provide the information:",
form_id: process.argv[2],
type: "google",
name: 'Google Form',
message: 'Please provide the information:',
formId: process.argv[2] || FORM_ID,
type: 'google',
skip() {
return this.state.answers.confirm !== true;
return this.state.answers.confirm !== true;
}
}
])
.then(res => console.log(res))
.catch(err => console.log(err));
.catch(err => console.log(err));
15 changes: 9 additions & 6 deletions examples/googleform/prompt.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
const GoogleFormPrompt = require("prompt-google-form");
'use strict';

const GoogleFormPrompt = require('..');
adityavyas611 marked this conversation as resolved.
Show resolved Hide resolved
const { FORM_ID } = require('./constants');

const prompt = new GoogleFormPrompt({
name: "Google Form",
message: "Please provide the information:",
form_id: process.argv[2],
name: 'Google Form',
message: 'Please provide the information:',
formId: process.argv[2] || FORM_ID,
});

prompt.run()
.then(res => console.log(res))
.catch(err => console.log(err));
.then(res => console.log(res))
.catch(err => console.log(err));
28 changes: 15 additions & 13 deletions examples/googleform/selectForm.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
const Enquirer = require("enquirer");
const GoogleFormPrompt = require("prompt-google-form");
'use strict';

const Enquirer = require('enquirer');
const GoogleFormPrompt = require('..');
adityavyas611 marked this conversation as resolved.
Show resolved Hide resolved

const enquirer = new Enquirer();
enquirer.register("google", GoogleFormPrompt);
enquirer.register('google', GoogleFormPrompt);

enquirer
.prompt([
{
type: "select",
name: "form",
message: "Which Form Would you like to fill out?",
type: 'select',
name: 'form',
message: 'Which Form Would you like to fill out?',
choices: [{
value: '1FAIpQLSdniaX5nAjywbvnT9tQp1OTryh7148Lkl5LnvJV1mBOy1QXdA',
message: 'Contact Form'
},{
}, {
value: '1FAIpQLSfb_pdS57UJTS1qKaKfSLoDs9pudHLbNbkpp74kdpUYoEKz9Q',
message: 'T-Shirt Form'
},{
}, {
value: '1FAIpQLSd5YEpcRFJAE47OuvHyI6equ66DEspA9S2AZHCafhokHUbjWg',
message: 'Event Form'
}]
},
{
name: "Google Form",
message: "Please provide the information:",
formId(state){
name: 'Google Form',
message: 'Please provide the information:',
formId(state) {
return state.answers.form;
},
type: "google"
type: 'google'
}
])
.then(res => console.log(res))
.catch(err => console.log(err));
.catch(err => console.log(err));