@@ -7,7 +7,7 @@ import { outputFlags, validationFlags } from '../../flags/index.js'
7
7
// import { handleApiCall, handleUnsuccessfulApiResponse } from '../../utils/api-helpers.js'
8
8
import { InputError } from '../../utils/errors.js'
9
9
import { printFlagList } from '../../utils/formatting.js'
10
- import { FREE_API_KEY , getDefaultKey , setupSdk } from '../../utils/sdk.js'
10
+ // import { FREE_API_KEY, getDefaultKey, setupSdk } from '../../utils/sdk.js'
11
11
12
12
/** @type {import('../../utils/meow-with-subcommands').CliSubcommand } */
13
13
export const analytics = {
@@ -17,9 +17,9 @@ export const analytics = {
17
17
18
18
const input = setupCommand ( name , analytics . description , argv , importMeta )
19
19
if ( input ) {
20
- const spinner = ora ( " Fetching analytics data" ) . start ( )
20
+ const spinner = ora ( ' Fetching analytics data' ) . start ( )
21
21
console . log ( input )
22
- if ( input . scope === 'org' ) {
22
+ if ( input . scope === 'org' ) {
23
23
await fetchOrgAnalyticsData ( input . time , spinner )
24
24
} else {
25
25
// await fetchRepoAnalyticsData(input.time, spinner)
@@ -32,8 +32,8 @@ export const analytics = {
32
32
33
33
/**
34
34
* @typedef CommandContext
35
- * @property {string } scope
36
- * @property {string } time
35
+ * @property {string } scope
36
+ * @property {string } time
37
37
*/
38
38
39
39
/**
@@ -68,24 +68,24 @@ function setupCommand (name, description, argv, importMeta) {
68
68
69
69
const scope = cli . input [ 0 ]
70
70
71
- if ( ! scope ) {
72
- throw new InputError ( " Please provide a scope to get analytics data" )
71
+ if ( ! scope ) {
72
+ throw new InputError ( ' Please provide a scope to get analytics data' )
73
73
}
74
74
75
- if ( ! cli . input . length ) {
76
- throw new InputError ( " Please provide a scope and a time to get analytics data" )
75
+ if ( ! cli . input . length ) {
76
+ throw new InputError ( ' Please provide a scope and a time to get analytics data' )
77
77
}
78
78
79
- if ( scope && ! [ 'org' , 'repo' ] . includes ( scope ) ) {
79
+ if ( scope && ! [ 'org' , 'repo' ] . includes ( scope ) ) {
80
80
throw new InputError ( "The scope must either be 'scope' or 'repo'" )
81
81
}
82
82
const time = cli . input [ 1 ]
83
83
84
- if ( ! time ) {
85
- throw new InputError ( " Please provide a time to get analytics data" )
84
+ if ( ! time ) {
85
+ throw new InputError ( ' Please provide a time to get analytics data' )
86
86
}
87
87
88
- if ( time && ! [ '7' , '30' , '60' ] . includes ( time ) ) {
88
+ if ( time && ! [ '7' , '30' , '60' ] . includes ( time ) ) {
89
89
throw new InputError ( 'The time filter must either be 7, 30 or 60' )
90
90
}
91
91
@@ -106,16 +106,17 @@ function setupCommand (name, description, argv, importMeta) {
106
106
*/
107
107
// * @returns {Promise<void|AnalyticsData> }
108
108
async function fetchOrgAnalyticsData ( time , spinner ) {
109
- const socketSdk = await setupSdk ( getDefaultKey ( ) || FREE_API_KEY )
109
+ // const socketSdk = await setupSdk(getDefaultKey() || FREE_API_KEY)
110
110
console . table ( time )
111
+ console . log ( spinner )
111
112
112
113
// const result = await handleApiCall(socketSdk.getOrgAnalytics(time), 'fetching analytics data')
113
-
114
+
114
115
// if (result.success === false) {
115
116
// return handleUnsuccessfulApiResponse('getOrgAnalytics', result, spinner)
116
117
// }
117
118
118
119
// return {
119
-
120
+
120
121
// }
121
122
}
0 commit comments