git-coco 0.7.3 β 0.7.5
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.
- package/dist/index.d.ts +3 -1
- package/dist/index.esm.mjs +30 -19
- package/dist/index.js +30 -19
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -99,6 +99,7 @@ declare const _default: {
|
|
|
99
99
|
builder: (yargs: yargs.Argv<{}>) => yargs.Argv<yargs.Omit<{}, string> & yargs.InferredOptionTypes<Record<string, yargs.Options>>>;
|
|
100
100
|
handler: (argv: {
|
|
101
101
|
[x: string]: unknown;
|
|
102
|
+
level?: "global" | "project" | undefined;
|
|
102
103
|
interactive: boolean;
|
|
103
104
|
help: boolean;
|
|
104
105
|
verbose: boolean;
|
|
@@ -106,6 +107,7 @@ declare const _default: {
|
|
|
106
107
|
$0: string;
|
|
107
108
|
} | Promise<{
|
|
108
109
|
[x: string]: unknown;
|
|
110
|
+
level?: "global" | "project" | undefined;
|
|
109
111
|
interactive: boolean;
|
|
110
112
|
help: boolean;
|
|
111
113
|
verbose: boolean;
|
|
@@ -128,7 +130,7 @@ interface Config$1 {
|
|
|
128
130
|
* @example 'openai/gpt-3.5-turbo'
|
|
129
131
|
* @example 'huggingface/bigscience/bloom'
|
|
130
132
|
**/
|
|
131
|
-
service
|
|
133
|
+
service?: Service;
|
|
132
134
|
/**
|
|
133
135
|
* The OpenAI API key.
|
|
134
136
|
*/
|
package/dist/index.esm.mjs
CHANGED
|
@@ -1696,22 +1696,26 @@ async function createProjectFileAndReturnPath(fileName, contents) {
|
|
|
1696
1696
|
}
|
|
1697
1697
|
|
|
1698
1698
|
const handler = async (argv, logger) => {
|
|
1699
|
+
const options = loadConfig(argv);
|
|
1699
1700
|
logger.log(LOGO);
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1701
|
+
let level = options?.level;
|
|
1702
|
+
if (!level) {
|
|
1703
|
+
level = await select({
|
|
1704
|
+
message: 'configure coco for the current user or project?',
|
|
1705
|
+
choices: [
|
|
1706
|
+
{
|
|
1707
|
+
name: 'global',
|
|
1708
|
+
value: 'global',
|
|
1709
|
+
description: 'add coco config to your global git config',
|
|
1710
|
+
},
|
|
1711
|
+
{
|
|
1712
|
+
name: 'project',
|
|
1713
|
+
value: 'project',
|
|
1714
|
+
description: 'add coco config to existing git project',
|
|
1715
|
+
},
|
|
1716
|
+
],
|
|
1717
|
+
});
|
|
1718
|
+
}
|
|
1715
1719
|
let configFilePath = '';
|
|
1716
1720
|
switch (level) {
|
|
1717
1721
|
case 'project':
|
|
@@ -1730,7 +1734,7 @@ const handler = async (argv, logger) => {
|
|
|
1730
1734
|
});
|
|
1731
1735
|
configFilePath = await createProjectFileAndReturnPath(projectConfiguration);
|
|
1732
1736
|
break;
|
|
1733
|
-
case '
|
|
1737
|
+
case 'global':
|
|
1734
1738
|
default:
|
|
1735
1739
|
configFilePath = getPathToUsersGitConfig();
|
|
1736
1740
|
break;
|
|
@@ -1842,7 +1846,7 @@ const handler = async (argv, logger) => {
|
|
|
1842
1846
|
await appendToProjectConfig(configFilePath, config);
|
|
1843
1847
|
}
|
|
1844
1848
|
// After config is written, check for package installation
|
|
1845
|
-
await checkAndHandlePackageInstallation({ global: level === '
|
|
1849
|
+
await checkAndHandlePackageInstallation({ global: level === 'global', logger });
|
|
1846
1850
|
logger.log(`\ninit successful! π¦Ύπ€π`, { color: 'green' });
|
|
1847
1851
|
}
|
|
1848
1852
|
else {
|
|
@@ -1853,14 +1857,21 @@ const handler = async (argv, logger) => {
|
|
|
1853
1857
|
/**
|
|
1854
1858
|
* Command line options via yargs
|
|
1855
1859
|
*/
|
|
1856
|
-
const options = {
|
|
1860
|
+
const options = {
|
|
1861
|
+
level: {
|
|
1862
|
+
type: 'string',
|
|
1863
|
+
alias: 'l',
|
|
1864
|
+
description: 'configure coco for the current user or project?',
|
|
1865
|
+
choices: ['global', 'project'],
|
|
1866
|
+
},
|
|
1867
|
+
};
|
|
1857
1868
|
const builder = (yargs) => {
|
|
1858
1869
|
return yargs.options(options);
|
|
1859
1870
|
};
|
|
1860
1871
|
|
|
1861
1872
|
var init = {
|
|
1862
1873
|
command: 'init',
|
|
1863
|
-
desc: '
|
|
1874
|
+
desc: 'install & configure coco globally or for the current project',
|
|
1864
1875
|
builder,
|
|
1865
1876
|
handler: commandExecutor(handler),
|
|
1866
1877
|
options,
|
package/dist/index.js
CHANGED
|
@@ -1717,22 +1717,26 @@ async function createProjectFileAndReturnPath(fileName, contents) {
|
|
|
1717
1717
|
}
|
|
1718
1718
|
|
|
1719
1719
|
const handler = async (argv, logger) => {
|
|
1720
|
+
const options = loadConfig(argv);
|
|
1720
1721
|
logger.log(LOGO);
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1722
|
+
let level = options?.level;
|
|
1723
|
+
if (!level) {
|
|
1724
|
+
level = await prompts$1.select({
|
|
1725
|
+
message: 'configure coco for the current user or project?',
|
|
1726
|
+
choices: [
|
|
1727
|
+
{
|
|
1728
|
+
name: 'global',
|
|
1729
|
+
value: 'global',
|
|
1730
|
+
description: 'add coco config to your global git config',
|
|
1731
|
+
},
|
|
1732
|
+
{
|
|
1733
|
+
name: 'project',
|
|
1734
|
+
value: 'project',
|
|
1735
|
+
description: 'add coco config to existing git project',
|
|
1736
|
+
},
|
|
1737
|
+
],
|
|
1738
|
+
});
|
|
1739
|
+
}
|
|
1736
1740
|
let configFilePath = '';
|
|
1737
1741
|
switch (level) {
|
|
1738
1742
|
case 'project':
|
|
@@ -1751,7 +1755,7 @@ const handler = async (argv, logger) => {
|
|
|
1751
1755
|
});
|
|
1752
1756
|
configFilePath = await createProjectFileAndReturnPath(projectConfiguration);
|
|
1753
1757
|
break;
|
|
1754
|
-
case '
|
|
1758
|
+
case 'global':
|
|
1755
1759
|
default:
|
|
1756
1760
|
configFilePath = getPathToUsersGitConfig();
|
|
1757
1761
|
break;
|
|
@@ -1863,7 +1867,7 @@ const handler = async (argv, logger) => {
|
|
|
1863
1867
|
await appendToProjectConfig(configFilePath, config);
|
|
1864
1868
|
}
|
|
1865
1869
|
// After config is written, check for package installation
|
|
1866
|
-
await checkAndHandlePackageInstallation({ global: level === '
|
|
1870
|
+
await checkAndHandlePackageInstallation({ global: level === 'global', logger });
|
|
1867
1871
|
logger.log(`\ninit successful! π¦Ύπ€π`, { color: 'green' });
|
|
1868
1872
|
}
|
|
1869
1873
|
else {
|
|
@@ -1874,14 +1878,21 @@ const handler = async (argv, logger) => {
|
|
|
1874
1878
|
/**
|
|
1875
1879
|
* Command line options via yargs
|
|
1876
1880
|
*/
|
|
1877
|
-
const options = {
|
|
1881
|
+
const options = {
|
|
1882
|
+
level: {
|
|
1883
|
+
type: 'string',
|
|
1884
|
+
alias: 'l',
|
|
1885
|
+
description: 'configure coco for the current user or project?',
|
|
1886
|
+
choices: ['global', 'project'],
|
|
1887
|
+
},
|
|
1888
|
+
};
|
|
1878
1889
|
const builder = (yargs) => {
|
|
1879
1890
|
return yargs.options(options);
|
|
1880
1891
|
};
|
|
1881
1892
|
|
|
1882
1893
|
var init = {
|
|
1883
1894
|
command: 'init',
|
|
1884
|
-
desc: '
|
|
1895
|
+
desc: 'install & configure coco globally or for the current project',
|
|
1885
1896
|
builder,
|
|
1886
1897
|
handler: commandExecutor(handler),
|
|
1887
1898
|
options,
|