From 12f4e63ea94d19b04a71b955b92155ab410b4598 Mon Sep 17 00:00:00 2001 From: zontreck Date: Fri, 30 Aug 2024 11:05:57 -0700 Subject: [PATCH] Add initial files --- cpp/CMakeLists.txt | 12 ++++++++ cpp/README.md | 1 + cpp/pause.cpp | 32 ++++++++++++++++++++ cpp/vsleep.cpp | 54 +++++++++++++++++++++++++++++++++ dart/.gitignore | 3 ++ dart/CHANGELOG.md | 3 ++ dart/README.md | 1 + dart/analysis_options.yaml | 30 +++++++++++++++++++ dart/bin/dart.dart | 61 ++++++++++++++++++++++++++++++++++++++ dart/pubspec.yaml | 18 +++++++++++ 10 files changed, 215 insertions(+) create mode 100644 cpp/CMakeLists.txt create mode 100644 cpp/README.md create mode 100644 cpp/pause.cpp create mode 100644 cpp/vsleep.cpp create mode 100644 dart/.gitignore create mode 100644 dart/CHANGELOG.md create mode 100644 dart/README.md create mode 100644 dart/analysis_options.yaml create mode 100644 dart/bin/dart.dart create mode 100644 dart/pubspec.yaml diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt new file mode 100644 index 0000000..cbfe95c --- /dev/null +++ b/cpp/CMakeLists.txt @@ -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) diff --git a/cpp/README.md b/cpp/README.md new file mode 100644 index 0000000..4882e48 --- /dev/null +++ b/cpp/README.md @@ -0,0 +1 @@ +This folder contains older versions of the helper tools that were previously written in C++. diff --git a/cpp/pause.cpp b/cpp/pause.cpp new file mode 100644 index 0000000..ab65e62 --- /dev/null +++ b/cpp/pause.cpp @@ -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 +#include +#include +#include +#include +#include + +using namespace std; + +int main(int argc, const char *argv[]) { + + cout << "Press enter to continue\r"; + cin.ignore(); + cout << endl; + return 0; +} diff --git a/cpp/vsleep.cpp b/cpp/vsleep.cpp new file mode 100644 index 0000000..c2df4db --- /dev/null +++ b/cpp/vsleep.cpp @@ -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 +#include +#include +#include +#include + +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; +} diff --git a/dart/.gitignore b/dart/.gitignore new file mode 100644 index 0000000..3a85790 --- /dev/null +++ b/dart/.gitignore @@ -0,0 +1,3 @@ +# https://dart.dev/guides/libraries/private-files +# Created by `dart pub` +.dart_tool/ diff --git a/dart/CHANGELOG.md b/dart/CHANGELOG.md new file mode 100644 index 0000000..effe43c --- /dev/null +++ b/dart/CHANGELOG.md @@ -0,0 +1,3 @@ +## 1.0.0 + +- Initial version. diff --git a/dart/README.md b/dart/README.md new file mode 100644 index 0000000..b7639b5 --- /dev/null +++ b/dart/README.md @@ -0,0 +1 @@ +A sample command-line application providing basic argument parsing with an entrypoint in `bin/`. diff --git a/dart/analysis_options.yaml b/dart/analysis_options.yaml new file mode 100644 index 0000000..dee8927 --- /dev/null +++ b/dart/analysis_options.yaml @@ -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 diff --git a/dart/bin/dart.dart b/dart/bin/dart.dart new file mode 100644 index 0000000..564e1f2 --- /dev/null +++ b/dart/bin/dart.dart @@ -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 [arguments]'); + print(argParser.usage); +} + +void main(List 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); + } +} diff --git a/dart/pubspec.yaml b/dart/pubspec.yaml new file mode 100644 index 0000000..e606198 --- /dev/null +++ b/dart/pubspec.yaml @@ -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