Add initial files

This commit is contained in:
zontreck 2024-08-30 11:05:57 -07:00
parent 203069260d
commit 12f4e63ea9
10 changed files with 215 additions and 0 deletions

12
cpp/CMakeLists.txt Normal file
View file

@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.20)
project(sht)
set(CMAKE_CXX_STANDARD 17)
add_executable(vsleep vsleep.cpp)
install(TARGETS vsleep
RUNTIME DESTINATION /usr/bin
)
add_executable(pause pause.cpp)
install(TARGETS sleep RUNTIME DESTINATION /usr/bin)

1
cpp/README.md Normal file
View file

@ -0,0 +1 @@
This folder contains older versions of the helper tools that were previously written in C++.

32
cpp/pause.cpp Normal file
View file

@ -0,0 +1,32 @@
/*
*
* Pause CPP
* COPYRIGHT 2023 Tara Piccari
*
*
* This file is a part of Pause (https://github.com/zontreck/PauseCpp)
* It is Licensed under the GPL v3.
*
* Please submit any changes or improvements to the Github in the form of a ticket or a pull request.
*
* Thank you.
*
*/
#include <iostream>
#include <string>
#include <stdlib.h>
#include <chrono>
#include <stdio.h>
#include <thread>
using namespace std;
int main(int argc, const char *argv[]) {
cout << "Press enter to continue\r";
cin.ignore();
cout << endl;
return 0;
}

54
cpp/vsleep.cpp Normal file
View file

@ -0,0 +1,54 @@
/*
*
* VERBOSE SLEEP
* COPYRIGHT 2023 Tara Piccari
*
*
* This file is a part of Verbose Sleep (https://github.com/zontreck/VerboseSleep)
* It is Licensed under the GPL v3.
*
* Please submit any changes or improvements to the Github in the form of a ticket or a pull request.
*
* Thank you.
*
*/
#include <iostream>
#include <string>
#include <stdlib.h>
#include <chrono>
#include <thread>
using namespace std;
using namespace chrono_literals;
using namespace chrono;
using namespace this_thread;
int main(int argc, const char *argv[]) {
if(argc<2){
cout << "Verbose Sleep\nhttps://github.com/zontreck/VerboseSleep\nCopyright 2023 Tara Piccari\n\n" << argv[0] <<
" [seconds]\n\n"
<< "[seconds]\t\t-\tThe number of seconds to sleep and countdown"
<< endl
<< endl;
return 1;
}
int paramx = atoi(argv[1]);
//cout << "Argument 1 : " << argv[1] << endl;
while(paramx>0)
{
printf("\rWaiting for %d second(s) \r", paramx);
cout << flush;
sleep_for(seconds(1));
paramx--;
}
//cout << endl;
cout << "\r \r";
return paramx;
}

3
dart/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
# https://dart.dev/guides/libraries/private-files
# Created by `dart pub`
.dart_tool/

3
dart/CHANGELOG.md Normal file
View file

@ -0,0 +1,3 @@
## 1.0.0
- Initial version.

1
dart/README.md Normal file
View file

@ -0,0 +1 @@
A sample command-line application providing basic argument parsing with an entrypoint in `bin/`.

View file

@ -0,0 +1,30 @@
# This file configures the static analysis results for your project (errors,
# warnings, and lints).
#
# This enables the 'recommended' set of lints from `package:lints`.
# This set helps identify many issues that may lead to problems when running
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
# style and format.
#
# If you want a smaller set of lints you can change this to specify
# 'package:lints/core.yaml'. These are just the most critical lints
# (the recommended set includes the core lints).
# The core lints are also what is used by pub.dev for scoring packages.
include: package:lints/recommended.yaml
# Uncomment the following section to specify additional rules.
# linter:
# rules:
# - camel_case_types
# analyzer:
# exclude:
# - path/to/excluded/files/**
# For more information about the core and recommended set of lints, see
# https://dart.dev/go/core-lints
# For additional information about configuring this file, see
# https://dart.dev/guides/language/analysis-options

61
dart/bin/dart.dart Normal file
View file

@ -0,0 +1,61 @@
import 'package:args/args.dart';
const String version = '0.0.1';
ArgParser buildParser() {
return ArgParser()
..addFlag(
'help',
abbr: 'h',
negatable: false,
help: 'Print this usage information.',
)
..addFlag(
'verbose',
abbr: 'v',
negatable: false,
help: 'Show additional command output.',
)
..addFlag(
'version',
negatable: false,
help: 'Print the tool version.',
);
}
void printUsage(ArgParser argParser) {
print('Usage: dart dart.dart <flags> [arguments]');
print(argParser.usage);
}
void main(List<String> arguments) {
final ArgParser argParser = buildParser();
try {
final ArgResults results = argParser.parse(arguments);
bool verbose = false;
// Process the parsed arguments.
if (results.wasParsed('help')) {
printUsage(argParser);
return;
}
if (results.wasParsed('version')) {
print('dart version: $version');
return;
}
if (results.wasParsed('verbose')) {
verbose = true;
}
// Act on the arguments provided.
print('Positional arguments: ${results.rest}');
if (verbose) {
print('[VERBOSE] All arguments: ${results.arguments}');
}
} on FormatException catch (e) {
// Print usage information if an invalid argument was provided.
print(e.message);
print('');
printUsage(argParser);
}
}

18
dart/pubspec.yaml Normal file
View file

@ -0,0 +1,18 @@
name: dart
description: A sample command-line application with basic argument parsing.
version: 0.0.1
# repository: https://github.com/my_org/my_repo
environment:
sdk: ^3.5.1
# Add regular dependencies here.
dependencies:
args: ^2.4.2
libac_dart:
hosted: https://git.zontreck.com/api/packages/AriasCreations/pub/
version: 1.2.82924+1846
dev_dependencies:
lints: ^4.0.0
test: ^1.24.0