@@ -29,7 +29,7 @@ const parse_arguments = () => {
2929 type : "boolean" ,
3030 } ,
3131 otp : {
32- description : "List of attributes interpreted as OTP code." ,
32+ description : "List of properties interpreted as OTP code." ,
3333 default : [ "otp" ] ,
3434 shortcut : "o" ,
3535 type : "array" ,
@@ -93,22 +93,23 @@ const concert_to_records = (args, vault) => {
9393 " " . repeat ( depth * 2 ) + "- " + group . getTitle ( ) + "\n" ,
9494 ) ;
9595 for ( const entry of group . getEntries ( ) ) {
96+ const properties = entry . _source . p || entry . _source . properties ;
9697 if ( args . info )
9798 process . stdout . write (
98- " " . repeat ( depth * 2 ) + " " + entry . _source . p . title . value + "\n" ,
99+ " " . repeat ( depth * 2 ) + " " + properties . title . value + "\n" ,
99100 ) ;
100101 // https://keepass.info/help/kb/imp_csv.html
101- const otp = args . otp . find ( ( otp ) => entry . _source . p [ otp ] ) ;
102+ const otp = args . otp . find ( ( otp ) => properties [ otp ] ) ;
102103 const record = {
103104 Group : [ ...parents , group . getTitle ( ) ] . join ( "/" ) ,
104- Title : entry . _source . p . title . value ,
105- Username : entry . _source . p . username ?. value ,
106- Password : entry . _source . p . password ?. value ,
107- URL : entry . _source . p . url ?. value ,
108- Notes : entry . _source . p . notes ?. value ,
109- TOTP : entry . _source . p [ otp ] ?. value ,
105+ Title : properties . title . value ,
106+ Username : properties . username ?. value ,
107+ Password : properties . password ?. value ,
108+ URL : properties . url ?. value ,
109+ Notes : properties . notes ?. value ,
110+ TOTP : properties [ otp ] ?. value ,
110111 } ;
111- for ( const attribute in entry . _source . p ) {
112+ for ( const property in properties ) {
112113 if (
113114 [
114115 "title" ,
@@ -117,17 +118,17 @@ const concert_to_records = (args, vault) => {
117118 "url" ,
118119 "notes" ,
119120 ...args . otp ,
120- ] . includes ( attribute )
121+ ] . includes ( property )
121122 )
122123 continue ;
123- if ( entry . _source . p [ attribute ] . value ) {
124+ if ( properties [ property ] . value ) {
124125 if ( ! record . Notes ) {
125126 record . Notes = "" ;
126127 } else {
127128 record . Notes += "\n\n" ;
128129 }
129130 record . Notes +=
130- `# ${ attribute } ` + "\n\n" + entry . _source . p [ attribute ] . value ;
131+ `# ${ property } ` + "\n\n" + properties [ property ] . value ;
131132 }
132133 }
133134 records . push ( record ) ;
0 commit comments