25 lines
564 B
C++
25 lines
564 B
C++
|
#include <os/ArgumentParser.h>
|
||
|
#include <stdio.h>
|
||
|
#include <unistd.h>
|
||
|
|
||
|
Result<int> luna_main(int argc, char** argv)
|
||
|
{
|
||
|
StringView target;
|
||
|
StringView link;
|
||
|
|
||
|
os::ArgumentParser parser;
|
||
|
parser.add_description("Create symbolic links.");
|
||
|
parser.add_system_program_info("ln"_sv);
|
||
|
parser.add_positional_argument(target, "target", true);
|
||
|
parser.add_positional_argument(link, "linkpath", true);
|
||
|
parser.parse(argc, argv);
|
||
|
|
||
|
if (symlink(target.chars(), link.chars()) < 0)
|
||
|
{
|
||
|
perror("ln");
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
return 0;
|
||
|
}
|