@@ -5,40 +5,40 @@ import process from "node:process";
55import { configDebugger } from "./debugger" ;
66
77interface Options {
8- configDir ?: string ;
8+ credentialDir ?: string ;
99 profile ?: string ;
1010 itemsRootDir ?: string ;
1111}
1212
1313class Config {
14- private configDir ?: string ;
14+ private credentialDir ?: string ;
1515 private itemsRootDir ?: string ;
1616 private credential ?: Credential ;
1717
1818 constructor ( ) { }
1919
2020 load ( options : Options ) {
21- this . configDir = this . resolveConfigDir ( options . configDir ) ;
21+ this . credentialDir = this . resolveConfigDir ( options . credentialDir ) ;
2222 this . itemsRootDir = this . resolveItemsRootDir ( options . itemsRootDir ) ;
2323 this . credential = new Credential ( {
24- credentialDir : this . configDir ,
24+ credentialDir : this . credentialDir ,
2525 profile : options . profile ,
2626 } ) ;
2727
2828 configDebugger (
2929 "load" ,
3030 JSON . stringify ( {
31- configDir : this . configDir ,
31+ credentialDir : this . credentialDir ,
3232 itemsRootDir : this . itemsRootDir ,
3333 } )
3434 ) ;
3535 }
3636
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" ) ;
4040 }
41- return this . configDir ;
41+ return this . credentialDir ;
4242 }
4343
4444 // TODO: filesystemrepo 側にあるべきか確認
@@ -63,19 +63,19 @@ class Config {
6363 return this . credential . setCredential ( credential ) ;
6464 }
6565
66- private resolveConfigDir ( configDirPath ?: string ) {
66+ private resolveConfigDir ( credentialDirPath ?: string ) {
6767 const packageName = "qiita-cli" ;
6868
6969 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 ) ;
7272 }
73- if ( ! configDirPath ) {
73+ if ( ! credentialDirPath ) {
7474 const homeDir = os . homedir ( ) ;
7575 return path . join ( homeDir , ".config" , packageName ) ;
7676 }
7777
78- return this . resolveFullPath ( configDirPath ) ;
78+ return this . resolveFullPath ( credentialDirPath ) ;
7979 }
8080
8181 private resolveItemsRootDir ( dirPath ?: string ) {
0 commit comments