1
- import { createGistApiConfig , getGist , createGist , editGist } from './gistApi'
2
1
import { existsSync , readFileSync , writeFileSync } from 'fs'
3
2
import { CloudClipConfig } from '../interfaces/interfaces'
3
+ import { getGist , createGist , editGist } from './gistApi'
4
+ import { createGistApiConfig } from '../helpers/request'
4
5
import clipboardy from 'clipboardy'
5
6
6
-
7
- const readConfig = ( configFile : string ) : CloudClipConfig => {
7
+ function readConfig ( configFile : string ) : CloudClipConfig {
8
8
if ( ! existsSync ( configFile ) ) {
9
9
return { }
10
10
}
11
11
return JSON . parse ( readFileSync ( configFile , 'utf-8' ) )
12
12
}
13
13
14
- const saveConfig = ( configFile : string , config : CloudClipConfig ) => {
14
+ function saveConfig ( configFile : string , config : CloudClipConfig ) {
15
15
writeFileSync ( configFile , JSON . stringify ( config , null , 2 ) )
16
16
}
17
17
18
- const setToken = ( configFile : string , config : CloudClipConfig , token : string ) => {
18
+ function setToken ( configFile : string , config : CloudClipConfig , token : string ) {
19
19
config . token = token
20
20
saveConfig ( configFile , config )
21
21
}
22
22
23
- const setGistId = ( configFile : string , config : CloudClipConfig , gistId : string ) => {
23
+ function setGistId ( configFile : string , config : CloudClipConfig , gistId : string ) {
24
24
config . gistId = gistId
25
25
saveConfig ( configFile , config )
26
26
}
@@ -96,4 +96,4 @@ export const clear = async (configFile: string) => {
96
96
} , { } )
97
97
await editGist ( apiConfig , config . gistId , '<Clipboard>' , files )
98
98
console . log ( 'Cloud clipboard cleared.' )
99
- }
99
+ }
0 commit comments