@@ -5,40 +5,40 @@ import process from "node:process";
5
5
import { configDebugger } from "./debugger" ;
6
6
7
7
interface Options {
8
- configDir ?: string ;
8
+ credentialDir ?: string ;
9
9
profile ?: string ;
10
10
itemsRootDir ?: string ;
11
11
}
12
12
13
13
class Config {
14
- private configDir ?: string ;
14
+ private credentialDir ?: string ;
15
15
private itemsRootDir ?: string ;
16
16
private credential ?: Credential ;
17
17
18
18
constructor ( ) { }
19
19
20
20
load ( options : Options ) {
21
- this . configDir = this . resolveConfigDir ( options . configDir ) ;
21
+ this . credentialDir = this . resolveConfigDir ( options . credentialDir ) ;
22
22
this . itemsRootDir = this . resolveItemsRootDir ( options . itemsRootDir ) ;
23
23
this . credential = new Credential ( {
24
- credentialDir : this . configDir ,
24
+ credentialDir : this . credentialDir ,
25
25
profile : options . profile ,
26
26
} ) ;
27
27
28
28
configDebugger (
29
29
"load" ,
30
30
JSON . stringify ( {
31
- configDir : this . configDir ,
31
+ credentialDir : this . credentialDir ,
32
32
itemsRootDir : this . itemsRootDir ,
33
33
} )
34
34
) ;
35
35
}
36
36
37
- getConfigDir ( ) {
38
- if ( ! this . configDir ) {
39
- throw new Error ( "configDir is undefined" ) ;
37
+ getCredentialDir ( ) {
38
+ if ( ! this . credentialDir ) {
39
+ throw new Error ( "credentialDir is undefined" ) ;
40
40
}
41
- return this . configDir ;
41
+ return this . credentialDir ;
42
42
}
43
43
44
44
// TODO: filesystemrepo 側にあるべきか確認
@@ -63,19 +63,19 @@ class Config {
63
63
return this . credential . setCredential ( credential ) ;
64
64
}
65
65
66
- private resolveConfigDir ( configDirPath ?: string ) {
66
+ private resolveConfigDir ( credentialDirPath ?: string ) {
67
67
const packageName = "qiita-cli" ;
68
68
69
69
if ( process . env . XDG_CONFIG_HOME ) {
70
- const configDir = process . env . XDG_CONFIG_HOME ;
71
- return path . join ( configDir , packageName ) ;
70
+ const credentialDir = process . env . XDG_CONFIG_HOME ;
71
+ return path . join ( credentialDir , packageName ) ;
72
72
}
73
- if ( ! configDirPath ) {
73
+ if ( ! credentialDirPath ) {
74
74
const homeDir = os . homedir ( ) ;
75
75
return path . join ( homeDir , ".config" , packageName ) ;
76
76
}
77
77
78
- return this . resolveFullPath ( configDirPath ) ;
78
+ return this . resolveFullPath ( credentialDirPath ) ;
79
79
}
80
80
81
81
private resolveItemsRootDir ( dirPath ?: string ) {
0 commit comments