add editorconfig, reformat all
This commit is contained in:
parent
e88493c58e
commit
1783ce4fba
|
@ -0,0 +1,40 @@
|
||||||
|
# This file is for unifying the coding style for different editors and IDEs
|
||||||
|
# editorconfig.org
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
# Spaces in coffee
|
||||||
|
[**.coffee]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[**.js]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[**.ts]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
# Tabs in less
|
||||||
|
[**.less]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[**.css]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[**.php]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[**.html]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 2
|
|
@ -1,12 +1,12 @@
|
||||||
const presets = [
|
const presets = [
|
||||||
[
|
[
|
||||||
"@babel/preset-env",
|
'@babel/preset-env',
|
||||||
{
|
{
|
||||||
targets: {
|
targets: {
|
||||||
node: 'current'
|
node: 'current'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
];
|
]
|
||||||
|
|
||||||
module.exports = { presets };
|
module.exports = { presets }
|
|
@ -6,55 +6,55 @@ import cv from './controlled_vocabulary'
|
||||||
import log, {LogLevelDesc} from 'loglevel'
|
import log, {LogLevelDesc} from 'loglevel'
|
||||||
|
|
||||||
interface ConfigOverride {
|
interface ConfigOverride {
|
||||||
iso_date_format?: string,
|
iso_date_format?: string,
|
||||||
log_actions?: string,
|
log_actions?: string,
|
||||||
log_level?: 'debug' | 'warn' | 'info',
|
log_level?: 'debug' | 'warn' | 'info',
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* configuration générale à importer dans les utilitaires
|
* configuration générale à importer dans les utilitaires
|
||||||
*/
|
*/
|
||||||
class config_rangement {
|
class config_rangement {
|
||||||
log_level: LogLevelDesc = 'debug' // 'debug' | 'warn' |'info'
|
log_level: LogLevelDesc = 'debug' // 'debug' | 'warn' |'info'
|
||||||
|
|
||||||
version = '1.0.0'
|
version = '1.0.0'
|
||||||
iso_date_format = 'yyyy-MM-DDTHH.mm.ss' // target format for dates in file names
|
iso_date_format = 'yyyy-MM-DDTHH.mm.ss' // target format for dates in file names
|
||||||
tagSeparator = ' '
|
tagSeparator = ' '
|
||||||
tagSectionSeparator = '--'
|
tagSectionSeparator = '--'
|
||||||
keepFreeText = true
|
keepFreeText = true
|
||||||
keepTags = true
|
keepTags = true
|
||||||
replaceUnderscoreWithSpaces = true
|
replaceUnderscoreWithSpaces = true
|
||||||
renameFolders = false
|
renameFolders = false
|
||||||
enableTestsLocally = false
|
enableTestsLocally = false
|
||||||
reportStatistics = true
|
reportStatistics = true
|
||||||
controlled_vocabulary = cv
|
controlled_vocabulary = cv
|
||||||
constants = constants
|
constants = constants
|
||||||
base_archive_folder = constants.base_archive_folder
|
base_archive_folder = constants.base_archive_folder
|
||||||
templates = mainTemplates;
|
templates = mainTemplates;
|
||||||
statistics = {};
|
statistics = {};
|
||||||
keepOriginalNameInRename = false;
|
keepOriginalNameInRename = false;
|
||||||
log_actions = true;
|
log_actions = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* override config if we want
|
* override config if we want
|
||||||
* @param overridingConfig
|
* @param overridingConfig
|
||||||
*/
|
*/
|
||||||
constructor(overridingConfig?: ConfigOverride) {
|
constructor(overridingConfig?: ConfigOverride) {
|
||||||
|
|
||||||
|
|
||||||
log.setLevel('info')
|
log.setLevel('info')
|
||||||
if (overridingConfig) {
|
if (overridingConfig) {
|
||||||
log.debug('configuration is overrided')
|
log.debug('configuration is overrided')
|
||||||
let keys = Object.keys(overridingConfig)
|
let keys = Object.keys(overridingConfig)
|
||||||
let self: any = this;
|
let self: any = this;
|
||||||
keys.forEach((elem, index) => {
|
keys.forEach((elem, index) => {
|
||||||
if (self[keys[index]]) {
|
if (self[keys[index]]) {
|
||||||
self[keys[index]] = elem
|
self[keys[index]] = elem
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const rangement_instance = new config_rangement({});
|
const rangement_instance = new config_rangement({});
|
||||||
|
|
|
@ -19,4 +19,4 @@ const folders = {
|
||||||
orgmode_folder: syncronized_folder + 'textes/orgmode',
|
orgmode_folder: syncronized_folder + 'textes/orgmode',
|
||||||
}
|
}
|
||||||
|
|
||||||
export default folders
|
export default folders
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
import constants from './folders'
|
import constants from './folders'
|
||||||
interface fileDetectionTemplate{
|
|
||||||
|
interface fileDetectionTemplate {
|
||||||
'example': string,
|
'example': string,
|
||||||
'pattern': any,
|
'pattern': any,
|
||||||
'auto_tag'?:string,
|
'auto_tag'?: string,
|
||||||
'auto_sort_folder'?:string
|
'auto_sort_folder'?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AssemblyOfFileDetection {
|
interface AssemblyOfFileDetection {
|
||||||
downloaded_pic: fileDetectionTemplate,
|
downloaded_pic: fileDetectionTemplate,
|
||||||
telegram_pic: fileDetectionTemplate,
|
telegram_pic: fileDetectionTemplate,
|
||||||
|
@ -12,50 +14,50 @@ interface AssemblyOfFileDetection {
|
||||||
open_camera_custom: fileDetectionTemplate,
|
open_camera_custom: fileDetectionTemplate,
|
||||||
screenshot: fileDetectionTemplate,
|
screenshot: fileDetectionTemplate,
|
||||||
gopro_front: fileDetectionTemplate,
|
gopro_front: fileDetectionTemplate,
|
||||||
gopro_back : fileDetectionTemplate
|
gopro_back: fileDetectionTemplate
|
||||||
}
|
}
|
||||||
|
|
||||||
const setOfFileDetections : AssemblyOfFileDetection= {
|
const setOfFileDetections: AssemblyOfFileDetection = {
|
||||||
'downloaded_pic':{
|
'downloaded_pic': {
|
||||||
'example': 'FyB8cZnWIAc21rw.jpg',
|
'example': 'FyB8cZnWIAc21rw.jpg',
|
||||||
'pattern': /^\-\w{15}\.jpg/,
|
'pattern': /^\-\w{15}\.jpg/,
|
||||||
'auto_tag':'',
|
'auto_tag': '',
|
||||||
'auto_sort_folder': constants.bazar_sub_folder
|
'auto_sort_folder': constants.bazar_sub_folder
|
||||||
},
|
},
|
||||||
'telegram_pic': {
|
'telegram_pic': {
|
||||||
'example': '-4900281569878475578_1109.jpg',
|
'example': '-4900281569878475578_1109.jpg',
|
||||||
'pattern': /^\-\d{19}_\d{4}/,
|
'pattern': /^\-\d{19}_\d{4}/,
|
||||||
'auto_tag':'',
|
'auto_tag': '',
|
||||||
'auto_sort_folder': constants.bazar_sub_folder
|
'auto_sort_folder': constants.bazar_sub_folder
|
||||||
},
|
},
|
||||||
'open_camera_default': {
|
'open_camera_default': {
|
||||||
'example': 'IMG_20230617_092120_3.jpg',
|
'example': 'IMG_20230617_092120_3.jpg',
|
||||||
'pattern': /^IMG_\d{8}/i,
|
'pattern': /^IMG_\d{8}/i,
|
||||||
'auto_tag':'',
|
'auto_tag': '',
|
||||||
'auto_sort_folder': constants.panoramax_captures_folder
|
'auto_sort_folder': constants.panoramax_captures_folder
|
||||||
},
|
},
|
||||||
'open_camera_custom': {
|
'open_camera_custom': {
|
||||||
'example': 'IMG_OC_20230617_092120_3.jpg',
|
'example': 'IMG_OC_20230617_092120_3.jpg',
|
||||||
'pattern': /^IMG_OC_\d{8}/i,
|
'pattern': /^IMG_OC_\d{8}/i,
|
||||||
'auto_tag':'',
|
'auto_tag': '',
|
||||||
'auto_sort_folder': constants.panoramax_captures_folder
|
'auto_sort_folder': constants.panoramax_captures_folder
|
||||||
},
|
},
|
||||||
'screenshot': {
|
'screenshot': {
|
||||||
'example': 'Screenshot 2023-06-15 at 15-26-04 Instance Panoramax OSM-FR.png',
|
'example': 'Screenshot 2023-06-15 at 15-26-04 Instance Panoramax OSM-FR.png',
|
||||||
'pattern': /^Screenshot/i,
|
'pattern': /^Screenshot/i,
|
||||||
'auto_tag':'screenshots',
|
'auto_tag': 'screenshots',
|
||||||
'auto_sort_folder': 'photos/captures écran screenshots'
|
'auto_sort_folder': 'photos/captures écran screenshots'
|
||||||
},
|
},
|
||||||
'gopro_front': {
|
'gopro_front': {
|
||||||
'example': 'GF010041.jpg',
|
'example': 'GF010041.jpg',
|
||||||
'pattern': /^GP?F\d+\.jpg/i,
|
'pattern': /^GP?F\d+\.jpg/i,
|
||||||
'auto_tag':'gopro-front gopro',
|
'auto_tag': 'gopro-front gopro',
|
||||||
'auto_sort_folder': constants.gopro_capture_folder
|
'auto_sort_folder': constants.gopro_capture_folder
|
||||||
},
|
},
|
||||||
'gopro_back': {
|
'gopro_back': {
|
||||||
'example': 'GB010041.jpg',
|
'example': 'GB010041.jpg',
|
||||||
'pattern': /^GP?B\d+\.jpg/i,
|
'pattern': /^GP?B\d+\.jpg/i,
|
||||||
'auto_tag':'gopro-back gopro',
|
'auto_tag': 'gopro-back gopro',
|
||||||
'auto_sort_folder': constants.gopro_capture_folder
|
'auto_sort_folder': constants.gopro_capture_folder
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import config_rangement from './conf/configs.js'
|
import config_rangement from './conf/configs.js'
|
||||||
|
|
||||||
let my_conf = new config_rangement({})
|
let my_conf = new config_rangement({})
|
||||||
|
|
||||||
console.log('config', my_conf.version)
|
console.log('config', my_conf.version)
|
||||||
|
|
||||||
function createFoldersFromConfig(){
|
function createFoldersFromConfig () {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
4
index.ts
4
index.ts
|
@ -6,10 +6,7 @@
|
||||||
/** ---------------------
|
/** ---------------------
|
||||||
libs
|
libs
|
||||||
--------------------- */
|
--------------------- */
|
||||||
import fs from 'node-fs'
|
|
||||||
import minimist from 'minimist'
|
|
||||||
import log from 'loglevel'
|
import log from 'loglevel'
|
||||||
import * as path from 'node:path'
|
|
||||||
/** ---------------------
|
/** ---------------------
|
||||||
custom utilities and configuration
|
custom utilities and configuration
|
||||||
--------------------- */
|
--------------------- */
|
||||||
|
@ -21,7 +18,6 @@ log.setLevel(rangement_instance.log_level)
|
||||||
log.info(' ')
|
log.info(' ')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
finder.parseArguments()
|
finder.parseArguments()
|
||||||
finder.guessFileNameOnAllFilesFromArguments()
|
finder.guessFileNameOnAllFilesFromArguments()
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
* https://jestjs.io/docs/configuration
|
* https://jestjs.io/docs/configuration
|
||||||
*/
|
*/
|
||||||
module.exports = {
|
module.exports = {
|
||||||
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|js?|tsx?|ts?)$",
|
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|js?|tsx?|ts?)$",
|
||||||
transform: {
|
transform: {
|
||||||
"^.+\\.jsx?$": "babel-jest",
|
"^.+\\.jsx?$": "babel-jest",
|
||||||
"^.+\\.mjs$": "babel-jest",
|
"^.+\\.mjs$": "babel-jest",
|
||||||
"^.+\\.ts$": "babel-jest",
|
"^.+\\.ts$": "babel-jest",
|
||||||
},
|
},
|
||||||
testPathIgnorePatterns: ["<rootDir>/build/", "<rootDir>/node_modules/"],
|
testPathIgnorePatterns: ["<rootDir>/build/", "<rootDir>/node_modules/"],
|
||||||
moduleFileExtensions: ["js", "jsx", "mjs"]
|
moduleFileExtensions: ["js", "jsx", "mjs"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,7 @@
|
||||||
/** ---------------------
|
/** ---------------------
|
||||||
libs
|
libs
|
||||||
--------------------- */
|
--------------------- */
|
||||||
import fs from 'node-fs'
|
|
||||||
import minimist from 'minimist'
|
|
||||||
import log from 'loglevel'
|
import log from 'loglevel'
|
||||||
import path from 'node:path'
|
|
||||||
/** ---------------------
|
/** ---------------------
|
||||||
custom utilities and configuration
|
custom utilities and configuration
|
||||||
--------------------- */
|
--------------------- */
|
||||||
|
@ -21,9 +18,6 @@ let mini_arguments
|
||||||
log.setLevel(rangement_instance.log_level)
|
log.setLevel(rangement_instance.log_level)
|
||||||
log.info(' ')
|
log.info(' ')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
finder.parseArguments()
|
finder.parseArguments()
|
||||||
|
|
||||||
finder.guessFileNameOnAllFilesFromArguments()
|
finder.guessFileNameOnAllFilesFromArguments()
|
||||||
|
|
|
@ -44,8 +44,6 @@ describe('detection in file name', () => {
|
||||||
|
|
||||||
describe('modification in file name', () => {
|
describe('modification in file name', () => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
test('should append to file name in the right place', () => {
|
test('should append to file name in the right place', () => {
|
||||||
let fileNameOriginal = 'mon texte -- famille vacances plage.jpg'
|
let fileNameOriginal = 'mon texte -- famille vacances plage.jpg'
|
||||||
let properties = finder.destructurateFileName(fileNameOriginal)
|
let properties = finder.destructurateFileName(fileNameOriginal)
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
import finder from "../utils/finder.ts";
|
|
||||||
import { Jest as mockUpload } from '@jest/environment'
|
|
||||||
|
|
||||||
xdescribe('rangement file detection', () => {
|
xdescribe('rangement file detection', () => {
|
||||||
|
|
||||||
// find how to mock process.env arguments
|
// find how to mock process.env arguments
|
||||||
// const call = mockUpload.mock.calls[0][0]
|
// const call = mockUpload.mock.calls[0][0]
|
||||||
|
|
||||||
test('returns a list of 2 files to parse when given the folder testFiles/meme_base', () => {
|
test('returns a list of 2 files to parse when given the folder testFiles/meme_base', () => {
|
||||||
});
|
})
|
||||||
test('returns a list of 1 file to parse when given the argument testFiles/image.jpg', () => {
|
test('returns a list of 1 file to parse when given the argument testFiles/image.jpg', () => {
|
||||||
});
|
})
|
||||||
test('returns a list of 0 file to parse when given the null argument', () => {
|
test('returns a list of 0 file to parse when given the null argument', () => {
|
||||||
});
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
xdescribe('detection and tagging with content found in PDF content', () => {
|
xdescribe('detection and tagging with content found in PDF content', () => {
|
||||||
|
|
||||||
xtest('should find invoice hint in pdf', () => {
|
xtest('should find invoice hint in pdf', () => {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
xdescribe('detection and renaming of templated file names', () => {
|
xdescribe('detection and renaming of templated file names', () => {
|
||||||
|
|
||||||
xtest('should detect screenshot pattern', () => {
|
xtest('should detect screenshot pattern', () => {
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
{
|
{
|
||||||
// This is an alias to @tsconfig/node16: https://github.com/tsconfig/bases
|
// This is an alias to @tsconfig/node16: https://github.com/tsconfig/bases
|
||||||
"extends": "ts-node/node16/tsconfig.json",
|
"extends": "ts-node/node16/tsconfig.json",
|
||||||
|
|
||||||
// Most ts-node options can be specified here using their programmatic names.
|
// Most ts-node options can be specified here using their programmatic names.
|
||||||
"ts-node": {
|
"ts-node": {
|
||||||
// It is faster to skip typechecking.
|
// It is faster to skip typechecking.
|
||||||
// Remove if you want ts-node to do typechecking.
|
// Remove if you want ts-node to do typechecking.
|
||||||
"transpileOnly": true,
|
"transpileOnly": true,
|
||||||
|
|
||||||
"files": true,
|
"files": true,
|
||||||
|
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
// compilerOptions specified here will override those declared below,
|
// compilerOptions specified here will override those declared below,
|
||||||
// but *only* in ts-node. Useful if you want ts-node and tsc to use
|
// but *only* in ts-node. Useful if you want ts-node and tsc to use
|
||||||
|
@ -18,5 +15,6 @@
|
||||||
},
|
},
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
// typescript options here
|
// typescript options here
|
||||||
|
"allowSyntheticDefaultImports": true
|
||||||
}
|
}
|
||||||
}
|
}
|
1085
utils/finder.ts
1085
utils/finder.ts
File diff suppressed because it is too large
Load Diff
|
@ -1,16 +1,16 @@
|
||||||
export interface fileDestructuration {
|
export interface fileDestructuration {
|
||||||
fullPath: string
|
fullPath: string
|
||||||
folderPath: string
|
folderPath: string
|
||||||
fileNameOriginal: string
|
fileNameOriginal: string
|
||||||
dateStampInFileNameOriginal: string
|
dateStampInFileNameOriginal: string
|
||||||
dateStampExif: string,
|
dateStampExif: string,
|
||||||
freeText: string,
|
freeText: string,
|
||||||
tags: string[],
|
tags: string[],
|
||||||
extension: string,
|
extension: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface taggingCommand {
|
export interface taggingCommand {
|
||||||
tagCommand: string,
|
tagCommand: string,
|
||||||
tagsToAdd: Array<string>,
|
tagsToAdd: Array<string>,
|
||||||
tagsToRemove: Array<string>
|
tagsToRemove: Array<string>
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import finder from './finder.js'
|
import finder from './finder.js'
|
||||||
|
|
||||||
|
|
||||||
const pathFolder = '/home/poule/encrypted/stockage-syncable/photos/a_dispatcher/tout'
|
const pathFolder = '/home/poule/encrypted/stockage-syncable/photos/a_dispatcher/tout'
|
||||||
const sortingFolder = '/home/poule/encrypted/stockage-syncable/photos/a_dispatcher'
|
const sortingFolder = '/home/poule/encrypted/stockage-syncable/photos/a_dispatcher'
|
||||||
|
@ -11,7 +10,7 @@ const fileDefinition = {
|
||||||
extension: '',
|
extension: '',
|
||||||
}
|
}
|
||||||
|
|
||||||
export function TestScreenShotIsFoundAndRenamed() {
|
export function TestScreenShotIsFoundAndRenamed () {
|
||||||
|
|
||||||
let screenShotMockFileName = 'Screenshot 2023-06-15 at 15-28-21 Instance Panoramax OSM-FR.png'
|
let screenShotMockFileName = 'Screenshot 2023-06-15 at 15-28-21 Instance Panoramax OSM-FR.png'
|
||||||
let screenShotMockFileNameExpected = '2023-06-15 at 15-28-21 Instance Panoramax OSM-FR -- screenshot.png'
|
let screenShotMockFileNameExpected = '2023-06-15 at 15-28-21 Instance Panoramax OSM-FR -- screenshot.png'
|
||||||
|
@ -26,7 +25,7 @@ export function TestScreenShotIsFoundAndRenamed() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function TestTagsAreDetectedInFileName() {
|
export function TestTagsAreDetectedInFileName () {
|
||||||
let mockFileName = '2023-06-15T10:11:12 -- screeenshot festival.png'
|
let mockFileName = '2023-06-15T10:11:12 -- screeenshot festival.png'
|
||||||
let expectedResult = ['screeenshot', 'festival']
|
let expectedResult = ['screeenshot', 'festival']
|
||||||
let found = finder.findTagSectionInString(mockFileName)
|
let found = finder.findTagSectionInString(mockFileName)
|
||||||
|
@ -35,8 +34,7 @@ export function TestTagsAreDetectedInFileName() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function TestFindFormattedDate () {
|
||||||
export function TestFindFormattedDate() {
|
|
||||||
let mockFileName = 'Capture d\'écran 2023-06-15T10:11:12.png'
|
let mockFileName = 'Capture d\'écran 2023-06-15T10:11:12.png'
|
||||||
let expectedResult = '2023-06-15T10:11:12'
|
let expectedResult = '2023-06-15T10:11:12'
|
||||||
let found = finder.findFormattedDate(mockFileName)
|
let found = finder.findFormattedDate(mockFileName)
|
||||||
|
|
|
@ -134,7 +134,6 @@ class notReadyFunctions {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// run tests
|
// run tests
|
||||||
if (rangement_instance.enableTestsLocally) {
|
if (rangement_instance.enableTestsLocally) {
|
||||||
|
|
||||||
|
@ -143,7 +142,4 @@ if (rangement_instance.enableTestsLocally) {
|
||||||
TestScreenShotIsFoundAndRenamed()
|
TestScreenShotIsFoundAndRenamed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default notReadyFunctions
|
export default notReadyFunctions
|
|
@ -2,37 +2,36 @@
|
||||||
création de la config
|
création de la config
|
||||||
*/
|
*/
|
||||||
// import i18next from 'i18next'
|
// import i18next from 'i18next'
|
||||||
import config_rangement from "../../conf/configs.js";
|
import config_rangement from '../../conf/configs.js'
|
||||||
|
|
||||||
const { stdin, stdout } = process;
|
const { stdin, stdout } = process
|
||||||
|
|
||||||
function prompt(question) {
|
function prompt (question) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
stdin.resume();
|
stdin.resume()
|
||||||
stdout.write(question);
|
stdout.write(question)
|
||||||
|
|
||||||
stdin.on('data', data => resolve(data.toString().trim()));
|
stdin.on('data', data => resolve(data.toString().trim()))
|
||||||
stdin.on('error', err => reject(err));
|
stdin.on('error', err => reject(err))
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function main () {
|
||||||
|
try {
|
||||||
|
// const name = await prompt(i18next.t("home.title"))
|
||||||
|
const name = await prompt(`squoi le dossier de base des archives? [${config_rangement.base_archive_folder}]`)
|
||||||
|
// const age = await prompt("What's your age? ");
|
||||||
|
// const email = await prompt("What's your email address? ");
|
||||||
|
// const user = { name, age, email };
|
||||||
|
console.log('le dossier de base des archives est : ', name)
|
||||||
|
|
||||||
async function main() {
|
stdin.pause()
|
||||||
try {
|
} catch (error) {
|
||||||
// const name = await prompt(i18next.t("home.title"))
|
console.log('There\'s an error!')
|
||||||
const name = await prompt(`squoi le dossier de base des archives? [${config_rangement.base_archive_folder}]`)
|
console.log(error)
|
||||||
// const age = await prompt("What's your age? ");
|
}
|
||||||
// const email = await prompt("What's your email address? ");
|
process.exit()
|
||||||
// const user = { name, age, email };
|
|
||||||
console.log('le dossier de base des archives est : ',name);
|
|
||||||
|
|
||||||
stdin.pause();
|
|
||||||
} catch(error) {
|
|
||||||
console.log("There's an error!");
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
process.exit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main();
|
main()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue