added C++ based nuke tool to nuke dirs/files
This commit is contained in:
parent
887fa8cdaf
commit
ab4fb231e5
5 changed files with 24 additions and 11 deletions
1
cat.c
1
cat.c
|
@ -7,7 +7,6 @@
|
||||||
#include<string.h>
|
#include<string.h>
|
||||||
int main(int argc,char *argv[])
|
int main(int argc,char *argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
if(argc==1) {
|
if(argc==1) {
|
||||||
read_from_stdin();
|
read_from_stdin();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
14
meson.build
14
meson.build
|
@ -1,12 +1,13 @@
|
||||||
project('patricus utils', 'c', version: '3.4')
|
project('patricus utils', 'c', 'cpp', version: '4.0', default_options: ['cpp_std=c++20'])
|
||||||
|
|
||||||
# Get the short git commit hash
|
branch_name = run_command('git', 'rev-parse', '--abbrev-ref', 'HEAD', check: true).stdout().strip()
|
||||||
|
if branch_name.startswith('stable/')
|
||||||
|
full_version = meson.project_version()
|
||||||
|
else
|
||||||
git_hash = run_command('git', 'rev-parse', 'HEAD', check: true).stdout().strip()
|
git_hash = run_command('git', 'rev-parse', 'HEAD', check: true).stdout().strip()
|
||||||
|
|
||||||
# Combine version and hash
|
|
||||||
full_version = '@0@(@1@)'.format(meson.project_version(), git_hash)
|
full_version = '@0@(@1@)'.format(meson.project_version(), git_hash)
|
||||||
|
endif
|
||||||
|
|
||||||
# Generate header
|
|
||||||
conf = configuration_data()
|
conf = configuration_data()
|
||||||
conf.set('version', '"@0@"'.format(full_version))
|
conf.set('version', '"@0@"'.format(full_version))
|
||||||
|
|
||||||
|
@ -16,4 +17,5 @@ configure_file(
|
||||||
)
|
)
|
||||||
|
|
||||||
executable('cat', ['cat.c', 'stdin.c'], include_directories: '.')
|
executable('cat', ['cat.c', 'stdin.c'], include_directories: '.')
|
||||||
executable('cmpsize', ['cmpsize.c', 'bytes.c'], include_directories: '.')
|
executable('cmpsize', ['cmpsize.c', 'bytes.c'])
|
||||||
|
executable('nuke', ['nuke.cpp'], include_directories: '.')
|
||||||
|
|
14
nuke.cpp
Normal file
14
nuke.cpp
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#include<filesystem>
|
||||||
|
#include<iostream>
|
||||||
|
using namespace std;
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
for(int i=1;i<argc;i++){
|
||||||
|
if(!filesystem::exists(argv[i]))
|
||||||
|
{
|
||||||
|
cerr<<"error, no such file or directory";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
filesystem::remove_all(argv[i]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1 +0,0 @@
|
||||||
0.1
|
|
|
@ -1 +0,0 @@
|
||||||
0.1 meow.c
|
|
Loading…
Add table
Add a link
Reference in a new issue