82 lines
1.7 KiB
TypeScript
82 lines
1.7 KiB
TypeScript
/*
|
|
This file is part of »mimir«.
|
|
|
|
Copyright 2025 kcf <fenris@folksprak.org>
|
|
|
|
»mimir« is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Lesser General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
»mimir« is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
along with »mimir«. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
namespace _mimir.transfer.local
|
|
{
|
|
|
|
/**
|
|
*/
|
|
export type type_parameters = {
|
|
directory : string;
|
|
};
|
|
|
|
|
|
/**
|
|
*/
|
|
export function execute(
|
|
parameters : type_parameters,
|
|
name : string,
|
|
stamp : string,
|
|
directory : string
|
|
) : Array<string>
|
|
{
|
|
const result : Array<string> = [];
|
|
const target_directory : string = lib_plankton.string.coin(
|
|
"{{base}}/{{stamp}}/{{name}}",
|
|
{
|
|
"base": parameters.directory,
|
|
"stamp": stamp,
|
|
"name": name,
|
|
}
|
|
);
|
|
result.push(
|
|
lib_plankton.string.coin(
|
|
"mkdir --parents {{directory}}",
|
|
{
|
|
"directory": target_directory,
|
|
}
|
|
)
|
|
);
|
|
result.push(
|
|
lib_plankton.string.coin(
|
|
"mv {{directory_from}}/* {{directory_to}}/",
|
|
{
|
|
"directory_from": directory,
|
|
"directory_to": target_directory,
|
|
}
|
|
)
|
|
);
|
|
return result;
|
|
}
|
|
|
|
|
|
/**
|
|
*/
|
|
export function logic(
|
|
parameters : type_parameters
|
|
) : _mimir.transfer.type_logic
|
|
{
|
|
return {
|
|
"execute": (name, stamp, directory) => execute(parameters, name, stamp, directory),
|
|
};
|
|
}
|
|
|
|
}
|
|
|