From 75be783e899df9351c706e782ecbfb5bfff66b5c Mon Sep 17 00:00:00 2001 From: jaroshevskii Date: Fri, 28 Jul 2023 01:48:57 +0300 Subject: [PATCH 01/24] Init --- .vscode/launch.json | 28 +++++ Package.swift | 18 ++- README.md | 184 ----------------------------- Sources/RepifyCommand.swift | 19 +++ Sources/repeat-cli/RepeatCLI.swift | 78 ------------ _config.yml | 5 - 6 files changed, 55 insertions(+), 277 deletions(-) create mode 100644 .vscode/launch.json delete mode 100644 README.md create mode 100644 Sources/RepifyCommand.swift delete mode 100644 Sources/repeat-cli/RepeatCLI.swift delete mode 100644 _config.yml diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..375412d --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,28 @@ +{ + "configurations": [ + { + "type": "lldb", + "request": "launch", + "sourceLanguages": [ + "swift" + ], + "name": "Debug RepifyCLI", + "program": "${workspaceFolder:repify-cli}/.build/debug/RepifyCLI", + "args": [], + "cwd": "${workspaceFolder:repify-cli}", + "preLaunchTask": "swift: Build Debug RepifyCLI" + }, + { + "type": "lldb", + "request": "launch", + "sourceLanguages": [ + "swift" + ], + "name": "Release RepifyCLI", + "program": "${workspaceFolder:repify-cli}/.build/release/RepifyCLI", + "args": [], + "cwd": "${workspaceFolder:repify-cli}", + "preLaunchTask": "swift: Build Release RepifyCLI" + } + ] +} \ No newline at end of file diff --git a/Package.swift b/Package.swift index 8e4bbdf..6a84081 100644 --- a/Package.swift +++ b/Package.swift @@ -1,21 +1,19 @@ -// swift-tools-version: 5.6 +// swift-tools-version: 5.8 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( - name: "RepeatCLI", + name: "RepifyCLI", dependencies: [ - // Dependencies declare other packages that this package depends on. - .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.2.0") + .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.0.0"), ], targets: [ - // Targets are the basic building blocks of a package. A target can define a module or a test suite. - // Targets can depend on other targets in this package, and on products in packages this package depends on. + // Targets are the basic building blocks of a package, defining a module or a test suite. + // Targets can depend on other targets in this package and products from dependencies. .executableTarget( - name: "repeat-cli", - dependencies: [ - .product(name: "ArgumentParser", package: "swift-argument-parser") - ]) + name: "RepifyCLI", + dependencies: [.product(name: "ArgumentParser", package: "swift-argument-parser")], + path: "Sources"), ] ) diff --git a/README.md b/README.md deleted file mode 100644 index 279412d..0000000 --- a/README.md +++ /dev/null @@ -1,184 +0,0 @@ -
-

Repify CLI

-

- A lightweight and user-friendly command-line application designed for text repeating. -

-

- -

-

- - Swift Compatibility - - - Platform Compatibility - - Platform Compatibility Windows -

-
- - - - - - - -## Installation - -RepeatCLI is not yet available in any package manager and there are no compiled versions 😮‍💨. So you have to compile manually. - -## Usage - -RepeatCLI is a CLI application, this means that the **application must be executed from the [Terminal](https://en.wikipedia.org/wiki/Terminal_emulator)**. - -### Basic repetition - -Use `repeat-cli ` to repeat the text. Where `` is your text. - -```zsh -repeat-cli Hello -``` - -**Result:** - -```zsh -% repeat-cli Hello -Hello -Hello -``` - -To repeat several words or even whole sentences, the text must be wrapped with an `'` or `"` symbol on both sides. - -```zsh -repeat-cli 'Be faster 🐢' -``` - -**Result:** - -```zsh -% repeat-cli 'Be faster 🐢' -Be faster 🐢 -Be faster 🐢 -``` - -> **Note:** If `` is missing you will get this error: -> -> ```zsh -> Error: Missing expected argument '' -> ``` - -### Number of repetition - -By default, the text will be repeated only twice. - -To set a custom number of repetitions, use `--count ` option. Where `` is a number. - -```zsh -repeat-cli 'I promise to always use UTF-8 🐶' --count 5 -``` - -> **Note:** You can also use shorter entry. -> -> ```zsh -> repeat-cli 'I promise to always use UTF-8 🐶' -c 5 -> ``` - -**Result:** - -```zsh -% repeat-cli 'I promise to always use UTF-8 🐶' --count 5 -I promise to always use UTF-8 🐶 -I promise to always use UTF-8 🐶 -I promise to always use UTF-8 🐶 -I promise to always use UTF-8 🐶 -I promise to always use UTF-8 🐶 -``` - -> **Note:** `` must be greater than zero. Otherwise you will get this error: -> -> ```zsh -> Error: 'count' must be greater than zero. -> ``` - -### Repetition counter - -To include a repetition counter, use `--include-counter` option. - -```zsh -repeat-cli 'Yare yare daze...' --count 3 --include-counter -``` -> **Note:** You can also use shorter entry. -> -> ```zsh -> repeat-cli 'Yare yare daze...' -c 3 -i -> ``` - -**Result:** - -```zsh -% repeat-cli 'Yare yare daze...' --count 3 --include-counter -1: Yare yare daze... -2: Yare yare daze... -3: Yare yare daze... -``` - -### Multiline - -Multiline may be useful if you need to repeat a text that consists of several lines, or write an arguments in a more readable version. - -To use multilining, you must use `\` as if it were a newline character. - -```zsh -repeat-cli 'Dum-dum-dum-dum, ditty dum-dum-dum \ - Dum, dum, dum' -``` - -**Result:** - -```zsh -% repeat cli 'Dum-dum-dum-dum, ditty dum-dum-dum \ - Dum, dum, dum' -Dum-dum-dum-dum, ditty dum-dum-dum -Dum, dum, dum -Dum-dum-dum-dum, ditty dum-dum-dum -Dum, dum, dum -``` - -### Arguments order does not matter - -RepeatCLI uses the following order of arguments: - -``` - [--count ] [--include-counter] -``` - -But that doesn't mean you have to follow it. **Any combination of arguments will be correct.** - -The following commands will work the same way: - -- `repeat-cli --count 1 --include-counter 'Hello everyone!'` -- `repeat-cli -с 1 'Hello everyone!' --include-counter ` -- `repeat-cli -i --count 1 'Hello everyone!'` - -## Contributing - -Interested in contributing to RepeatCLI? We'd love your help. RepeatCLI is an open source project, built one contribution at a time by users like you. - -## License - -Licensed under the [MIT License](LICENSE). diff --git a/Sources/RepifyCommand.swift b/Sources/RepifyCommand.swift new file mode 100644 index 0000000..7f76e2a --- /dev/null +++ b/Sources/RepifyCommand.swift @@ -0,0 +1,19 @@ +// +// RepifyCommand.swift +// RepifyCLI +// + +import ArgumentParser + +@main +struct RepifyCommand: ParsableCommand { + + @Argument(help: "The text to be repeated.") + var text: String + + func run() { + for _ in 0..<2 { + print(text) + } + } +} diff --git a/Sources/repeat-cli/RepeatCLI.swift b/Sources/repeat-cli/RepeatCLI.swift deleted file mode 100644 index 2a414bd..0000000 --- a/Sources/repeat-cli/RepeatCLI.swift +++ /dev/null @@ -1,78 +0,0 @@ -// -// RepeatCLI -// - -import ArgumentParser -import Foundation - -@main -struct RepeatCLI: ParsableCommand { - static var configuration = CommandConfiguration( - abstract: "📃 Simple command-line tool for text repeating.", - discussion: """ - LINKS: - Website: https://jaroshevskii.github.io/repeat-cli/ - GitHub: https://jaroshevskii/repeat-cli - """, - version: """ - RepeatCLI version 0.4.0 - Release: https://github.com/jaroshevskii/repeat-cli/releases/tag/v0.4.0 - """ - ) - - /// Default counter style. - static let defaultCounterStyle = #"\(number): "# - - /// Text for repeating. - @Argument(help: "Text for repeating.") - var text: String - - /// Number of `text` repetitions. - @Option( - name: [.customShort("c"), .customLong("count")], - parsing: .unconditional, - help: "Number of repetitions.") - var repeatCount: Int = 2 - - /// Text to insert between `text`. - @Option(name: .shortAndLong, help: "Text to insert between . The default is a newline.") - var separator: String = "\n" - - /// Include a counter with each repetition. - @Flag(name: .shortAndLong, help: "Include a counter withc earh repetition.") - var includeCounter = false - - /// Counter style. - @Option(name: .long, help: "Counter style.") - var counterStyle = defaultCounterStyle - - mutating func validate() throws { - guard repeatCount > 0 else { - throw ValidationError("'count' must be greater than zero.") - } - - if counterStyle != Self.defaultCounterStyle { - includeCounter = true - } - } - - func run() { - var repeatedText: String - - if includeCounter { - repeatedText = "" - - for index in 1...repeatCount { - let number = counterStyle.replacingOccurrences(of: #"\(number)"#, with: "\(index)") - repeatedText += "\(number)\(text)\(separator)" - } - } else { - repeatedText = String(repeating: "\(text)\(separator)", count: repeatCount) - } - - // Remove the vest separator at the end of `repeatedText`. - repeatedText.removeLast(separator.count) - - print(repeatedText) - } -} diff --git a/_config.yml b/_config.yml deleted file mode 100644 index 2ab5f3c..0000000 --- a/_config.yml +++ /dev/null @@ -1,5 +0,0 @@ -title: RepeatCLI -description: 📃 Simple cross-platform command-line tool for text repeating. -show_downloads: true -google_analytics: -theme: jekyll-theme-slate From 7a7c95dce69c49bec5cf557fc0eb9bc2de7c6821 Mon Sep 17 00:00:00 2001 From: jaroshevskii Date: Mon, 7 Aug 2023 17:55:00 +0300 Subject: [PATCH 02/24] Small fixes --- Sources/{RepifyCommand.swift => RepifyCLICommand.swift} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename Sources/{RepifyCommand.swift => RepifyCLICommand.swift} (72%) diff --git a/Sources/RepifyCommand.swift b/Sources/RepifyCLICommand.swift similarity index 72% rename from Sources/RepifyCommand.swift rename to Sources/RepifyCLICommand.swift index 7f76e2a..04c82d3 100644 --- a/Sources/RepifyCommand.swift +++ b/Sources/RepifyCLICommand.swift @@ -1,12 +1,12 @@ // -// RepifyCommand.swift +// RepifyCLICommand.swift // RepifyCLI // import ArgumentParser @main -struct RepifyCommand: ParsableCommand { +struct RepifyCLICommand: ParsableCommand { @Argument(help: "The text to be repeated.") var text: String From 7129b9521131fb69543a33bb22dc5a49cc44b14e Mon Sep 17 00:00:00 2001 From: jaroshevskii Date: Mon, 7 Aug 2023 17:55:56 +0300 Subject: [PATCH 03/24] Small fixes --- Sources/RepifyCLICommand.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Sources/RepifyCLICommand.swift b/Sources/RepifyCLICommand.swift index 04c82d3..187d18d 100644 --- a/Sources/RepifyCLICommand.swift +++ b/Sources/RepifyCLICommand.swift @@ -7,7 +7,6 @@ import ArgumentParser @main struct RepifyCLICommand: ParsableCommand { - @Argument(help: "The text to be repeated.") var text: String From a2e4634bb444fd4f8e727af457b9eba675df1d90 Mon Sep 17 00:00:00 2001 From: jaroshevskii Date: Mon, 7 Aug 2023 19:37:44 +0300 Subject: [PATCH 04/24] Small fixes --- .vscode/launch.json | 12 ++++++------ Package.swift | 2 +- Sources/{RepifyCLICommand.swift => Repify.swift} | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) rename Sources/{RepifyCLICommand.swift => Repify.swift} (72%) diff --git a/.vscode/launch.json b/.vscode/launch.json index 375412d..d6a2c05 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,11 +6,11 @@ "sourceLanguages": [ "swift" ], - "name": "Debug RepifyCLI", - "program": "${workspaceFolder:repify-cli}/.build/debug/RepifyCLI", + "name": "Debug repify", + "program": "${workspaceFolder:repify-cli}/.build/debug/repify", "args": [], "cwd": "${workspaceFolder:repify-cli}", - "preLaunchTask": "swift: Build Debug RepifyCLI" + "preLaunchTask": "swift: Build Debug repify" }, { "type": "lldb", @@ -18,11 +18,11 @@ "sourceLanguages": [ "swift" ], - "name": "Release RepifyCLI", - "program": "${workspaceFolder:repify-cli}/.build/release/RepifyCLI", + "name": "Release repify", + "program": "${workspaceFolder:repify-cli}/.build/release/repify", "args": [], "cwd": "${workspaceFolder:repify-cli}", - "preLaunchTask": "swift: Build Release RepifyCLI" + "preLaunchTask": "swift: Build Release repify" } ] } \ No newline at end of file diff --git a/Package.swift b/Package.swift index 6a84081..f005789 100644 --- a/Package.swift +++ b/Package.swift @@ -12,7 +12,7 @@ let package = Package( // Targets are the basic building blocks of a package, defining a module or a test suite. // Targets can depend on other targets in this package and products from dependencies. .executableTarget( - name: "RepifyCLI", + name: "repify", dependencies: [.product(name: "ArgumentParser", package: "swift-argument-parser")], path: "Sources"), ] diff --git a/Sources/RepifyCLICommand.swift b/Sources/Repify.swift similarity index 72% rename from Sources/RepifyCLICommand.swift rename to Sources/Repify.swift index 187d18d..e3df207 100644 --- a/Sources/RepifyCLICommand.swift +++ b/Sources/Repify.swift @@ -1,12 +1,12 @@ // -// RepifyCLICommand.swift +// Repify.swift // RepifyCLI // import ArgumentParser @main -struct RepifyCLICommand: ParsableCommand { +struct Repify: ParsableCommand { @Argument(help: "The text to be repeated.") var text: String From 2d663d2d385998c8bfd9f0616d0ed9014152918a Mon Sep 17 00:00:00 2001 From: jaroshevskii Date: Tue, 8 Aug 2023 00:45:14 +0300 Subject: [PATCH 05/24] Some update --- Sources/Repify.swift | 45 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/Sources/Repify.swift b/Sources/Repify.swift index e3df207..242c3a8 100644 --- a/Sources/Repify.swift +++ b/Sources/Repify.swift @@ -1,18 +1,49 @@ -// -// Repify.swift -// RepifyCLI -// - import ArgumentParser +import Foundation +/// A lightweight and user-friendly tool for effortlessly repeating and customizing text. @main struct Repify: ParsableCommand { + static var configuration = CommandConfiguration( + abstract: "A lightweight and user-friendly tool for effortlessly repeating and customizing text.", + discussion: """ + With Repify CLI, you can unleash your creativity by easily creating endless variations of text with just a few simple commands. + + LINKS: + Website: https://jaroshevskii.github.io/repify-cli + Discussions: https://github.com/jaroshevskii/repify-cli/discussions + Issues: https://github.com/jaroshevskii/repify-cli/issues + Repository: https://github.com/jaroshevskii/repify-cli + """ + ) + + /// The text to be repeated. @Argument(help: "The text to be repeated.") var text: String + /// The number of text repetitions. Default is 2. + @Option(name: .shortAndLong, help: "The number of text repetitions.") + var count: Int = 2 + + /// The delay (in seconds) between repetitions. + @Option(name: .shortAndLong, help: "The delay (in seconds) between repetitions.") + var delay: Double? + + /// Include repetition numbering. + @Flag(name: .shortAndLong, help: "Include repetition numbering.") + var includeNumbering: Bool = false + func run() { - for _ in 0..<2 { - print(text) + for i in 1...count { + if includeNumbering { + print("\(i): \(text)") + } else { + print(text) + } + + if let delay = delay, i < count { + Thread.sleep(forTimeInterval: delay) + } } } } From 42781040525a5eda97aaf3773def54fcbfc92519 Mon Sep 17 00:00:00 2001 From: jaroshevskii Date: Tue, 8 Aug 2023 01:16:32 +0300 Subject: [PATCH 06/24] Add separator option --- Sources/Repify.swift | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Sources/Repify.swift b/Sources/Repify.swift index 242c3a8..b6e5c09 100644 --- a/Sources/Repify.swift +++ b/Sources/Repify.swift @@ -23,26 +23,30 @@ struct Repify: ParsableCommand { /// The number of text repetitions. Default is 2. @Option(name: .shortAndLong, help: "The number of text repetitions.") - var count: Int = 2 + var count = 2 /// The delay (in seconds) between repetitions. @Option(name: .shortAndLong, help: "The delay (in seconds) between repetitions.") var delay: Double? + /// Separator between repetitions. + @Option(name: .shortAndLong, help: "The separator between repetitions.") + var separator = "\n" + /// Include repetition numbering. @Flag(name: .shortAndLong, help: "Include repetition numbering.") var includeNumbering: Bool = false func run() { for i in 1...count { - if includeNumbering { - print("\(i): \(text)") + let formatedText = includeNumbering ? "\(i): \(text)" : text + if i < count { + print(formatedText, terminator: separator) + if let delay { + Thread.sleep(forTimeInterval: delay) + } } else { - print(text) - } - - if let delay = delay, i < count { - Thread.sleep(forTimeInterval: delay) + print(formatedText) } } } From 75f4a627c680b12c59215cae6265781a93a4e516 Mon Sep 17 00:00:00 2001 From: jaroshevskii Date: Tue, 8 Aug 2023 01:56:37 +0300 Subject: [PATCH 07/24] Add format option --- Sources/Repify.swift | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/Sources/Repify.swift b/Sources/Repify.swift index b6e5c09..a03d768 100644 --- a/Sources/Repify.swift +++ b/Sources/Repify.swift @@ -25,28 +25,40 @@ struct Repify: ParsableCommand { @Option(name: .shortAndLong, help: "The number of text repetitions.") var count = 2 - /// The delay (in seconds) between repetitions. - @Option(name: .shortAndLong, help: "The delay (in seconds) between repetitions.") - var delay: Double? + /// Include repetition numbering. + @Flag(name: .shortAndLong, help: "Include repetition numbering.") + var includeNumbering: Bool = false + + /// The repetition format. + @Option(name: .shortAndLong, help: "The repetition format. Use \\(text) and \\(number) as placeholders.") + var format: String? /// Separator between repetitions. @Option(name: .shortAndLong, help: "The separator between repetitions.") var separator = "\n" - /// Include repetition numbering. - @Flag(name: .shortAndLong, help: "Include repetition numbering.") - var includeNumbering: Bool = false + /// The delay (in seconds) between repetitions. + @Option(name: .shortAndLong, help: "The delay (in seconds) between repetitions.") + var delay: Double? func run() { for i in 1...count { - let formatedText = includeNumbering ? "\(i): \(text)" : text + var formattedText: String + if let format { + formattedText = format + .replacingOccurrences(of: "\\(text)", with: text) + .replacingOccurrences(of: "\\(number)", with: "\(i)") + } else { + formattedText = includeNumbering ? "\(i): \(text)" : text + } + if i < count { - print(formatedText, terminator: separator) + print(formattedText, terminator: separator) if let delay { Thread.sleep(forTimeInterval: delay) } } else { - print(formatedText) + print(formattedText) } } } From e4622ef68352554dcd09d3db60c1255faf282d3c Mon Sep 17 00:00:00 2001 From: jaroshevskii Date: Tue, 8 Aug 2023 02:04:33 +0300 Subject: [PATCH 08/24] Add version option --- Sources/Repify.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sources/Repify.swift b/Sources/Repify.swift index a03d768..0fc25ec 100644 --- a/Sources/Repify.swift +++ b/Sources/Repify.swift @@ -4,7 +4,9 @@ import Foundation /// A lightweight and user-friendly tool for effortlessly repeating and customizing text. @main struct Repify: ParsableCommand { - static var configuration = CommandConfiguration( + static let version = "1.0.0" + + static let configuration = CommandConfiguration( abstract: "A lightweight and user-friendly tool for effortlessly repeating and customizing text.", discussion: """ With Repify CLI, you can unleash your creativity by easily creating endless variations of text with just a few simple commands. @@ -14,6 +16,10 @@ struct Repify: ParsableCommand { Discussions: https://github.com/jaroshevskii/repify-cli/discussions Issues: https://github.com/jaroshevskii/repify-cli/issues Repository: https://github.com/jaroshevskii/repify-cli + """, + version: """ + Repify CLI version \(version) + Release: https://github.com/jaroshevskii/repify-cli/releases/tag/v\(version) """ ) From 391331fe677684f40c2118a8171f572ea02eaa15 Mon Sep 17 00:00:00 2001 From: jaroshevskii Date: Tue, 8 Aug 2023 02:07:45 +0300 Subject: [PATCH 09/24] Small fixes --- Sources/Repify.swift | 7 +++++-- Sources/Version.swift | 8 ++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 Sources/Version.swift diff --git a/Sources/Repify.swift b/Sources/Repify.swift index 0fc25ec..90c258a 100644 --- a/Sources/Repify.swift +++ b/Sources/Repify.swift @@ -1,11 +1,14 @@ +// +// Repify.swift +// RepifyCLI +// + import ArgumentParser import Foundation /// A lightweight and user-friendly tool for effortlessly repeating and customizing text. @main struct Repify: ParsableCommand { - static let version = "1.0.0" - static let configuration = CommandConfiguration( abstract: "A lightweight and user-friendly tool for effortlessly repeating and customizing text.", discussion: """ diff --git a/Sources/Version.swift b/Sources/Version.swift new file mode 100644 index 0000000..049e2ff --- /dev/null +++ b/Sources/Version.swift @@ -0,0 +1,8 @@ +// +// Repify.swift +// RepifyCLI +// + +extension Repify { + static let version = "1.0.0" +} \ No newline at end of file From e193492ab7fe2f1768c4cd4bcd03ac2a378cba81 Mon Sep 17 00:00:00 2001 From: jaroshevskii Date: Tue, 8 Aug 2023 02:10:13 +0300 Subject: [PATCH 10/24] Small fixes --- Sources/Version.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Version.swift b/Sources/Version.swift index 049e2ff..6746b40 100644 --- a/Sources/Version.swift +++ b/Sources/Version.swift @@ -1,5 +1,5 @@ // -// Repify.swift +// Version.swift // RepifyCLI // From c1713dc9a9d8446f8af110f2a1ebb2f556a054bb Mon Sep 17 00:00:00 2001 From: Sasha Jaroshevskii <72662383+jaroshevskii@users.noreply.github.com> Date: Tue, 8 Aug 2023 23:24:27 +0300 Subject: [PATCH 11/24] Update Version.swift --- Sources/Version.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Version.swift b/Sources/Version.swift index 6746b40..81df5f5 100644 --- a/Sources/Version.swift +++ b/Sources/Version.swift @@ -4,5 +4,5 @@ // extension Repify { - static let version = "1.0.0" -} \ No newline at end of file + static let version = "1.0.0-rebuild" +} From 5759a9b0f5c681118dc5fac5c23c39e97304d412 Mon Sep 17 00:00:00 2001 From: jaroshevskii Date: Wed, 9 Aug 2023 00:01:35 +0300 Subject: [PATCH 12/24] Update siwft tools version --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index f005789..8e0df73 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.8 +// swift-tools-version: 5.4 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription From 65fde999fa88e8953ad9af119cdc01c9120a5857 Mon Sep 17 00:00:00 2001 From: jaroshevskii <72662383+jaroshevskii@users.noreply.github.com> Date: Tue, 8 Aug 2023 22:16:21 +0000 Subject: [PATCH 13/24] Small fixes --- Sources/Repify.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Repify.swift b/Sources/Repify.swift index 90c258a..b2d3719 100644 --- a/Sources/Repify.swift +++ b/Sources/Repify.swift @@ -53,7 +53,7 @@ struct Repify: ParsableCommand { func run() { for i in 1...count { var formattedText: String - if let format { + if let format = format { formattedText = format .replacingOccurrences(of: "\\(text)", with: text) .replacingOccurrences(of: "\\(number)", with: "\(i)") @@ -63,7 +63,7 @@ struct Repify: ParsableCommand { if i < count { print(formattedText, terminator: separator) - if let delay { + if let delay = delay { Thread.sleep(forTimeInterval: delay) } } else { From 5c5bfd967d5ddc1e5d793e36fa40383c56e51858 Mon Sep 17 00:00:00 2001 From: jaroshevskii <72662383+jaroshevskii@users.noreply.github.com> Date: Wed, 9 Aug 2023 17:44:08 +0000 Subject: [PATCH 14/24] Add Replit support --- .replit | 4 ++++ replit.nix | 5 +++++ 2 files changed, 9 insertions(+) create mode 100644 .replit create mode 100644 replit.nix diff --git a/.replit b/.replit new file mode 100644 index 0000000..900fb61 --- /dev/null +++ b/.replit @@ -0,0 +1,4 @@ +run = "swift run repify --help" + +[nix] +channel = "stable-22_11" diff --git a/replit.nix b/replit.nix new file mode 100644 index 0000000..e94d479 --- /dev/null +++ b/replit.nix @@ -0,0 +1,5 @@ +{ pkgs }: { + deps = [ + pkgs.swift + ]; +} \ No newline at end of file From 9f998ab6882abac2cf5fb9dc3bbff888c516950c Mon Sep 17 00:00:00 2001 From: jaroshevskii Date: Wed, 9 Aug 2023 20:48:33 +0300 Subject: [PATCH 15/24] Update coment --- Sources/Repify.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Repify.swift b/Sources/Repify.swift index 90c258a..4e88cf7 100644 --- a/Sources/Repify.swift +++ b/Sources/Repify.swift @@ -30,7 +30,7 @@ struct Repify: ParsableCommand { @Argument(help: "The text to be repeated.") var text: String - /// The number of text repetitions. Default is 2. + /// The number of text repetitions. @Option(name: .shortAndLong, help: "The number of text repetitions.") var count = 2 From bac2d6ae87ad41386a110c2e015ffad1fb052225 Mon Sep 17 00:00:00 2001 From: jaroshevskii <72662383+jaroshevskii@users.noreply.github.com> Date: Wed, 9 Aug 2023 18:39:13 +0000 Subject: [PATCH 16/24] Fixed a cache error during build --- .replit | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.replit b/.replit index 900fb61..e6ec80b 100644 --- a/.replit +++ b/.replit @@ -1,4 +1,6 @@ run = "swift run repify --help" +compile = "swift build || swift package clean && clear" + [nix] channel = "stable-22_11" From 57542af6414440c85dce6e2770c1f6dfec877b9d Mon Sep 17 00:00:00 2001 From: jaroshevskii Date: Wed, 9 Aug 2023 22:06:01 +0300 Subject: [PATCH 17/24] Fix link for website --- Sources/Repify.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Repify.swift b/Sources/Repify.swift index 0fd3873..913bed4 100644 --- a/Sources/Repify.swift +++ b/Sources/Repify.swift @@ -15,7 +15,7 @@ struct Repify: ParsableCommand { With Repify CLI, you can unleash your creativity by easily creating endless variations of text with just a few simple commands. LINKS: - Website: https://jaroshevskii.github.io/repify-cli + Website: https://jaroshevskii.github.io/repify-cli/ Discussions: https://github.com/jaroshevskii/repify-cli/discussions Issues: https://github.com/jaroshevskii/repify-cli/issues Repository: https://github.com/jaroshevskii/repify-cli From 1bb172199171025deab1fe24fe6ce14beeccbc09 Mon Sep 17 00:00:00 2001 From: Sasha Jaroshevskii <72662383+jaroshevskii@users.noreply.github.com> Date: Thu, 10 Aug 2023 00:27:21 +0300 Subject: [PATCH 18/24] Create README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..691469e --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +
+

Repify CLI

+

A lightweight and user-friendly tool for effortlessly repeating and customizing text.

+
+ +![Baner](https://github.com/jaroshevskii/repify-cli/assets/72662383/03a9702c-6937-4f2b-bc7f-562533cdf2b7) From 6d8f22fc9ce7eed0c6a33103f28125b925d9f4df Mon Sep 17 00:00:00 2001 From: Sasha Jaroshevskii <72662383+jaroshevskii@users.noreply.github.com> Date: Thu, 10 Aug 2023 00:29:05 +0300 Subject: [PATCH 19/24] Update README.md --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 691469e..7a880b7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ -
-

Repify CLI

-

A lightweight and user-friendly tool for effortlessly repeating and customizing text.

-
+

Repify CLI

+

A lightweight and user-friendly tool for effortlessly repeating and customizing text.

![Baner](https://github.com/jaroshevskii/repify-cli/assets/72662383/03a9702c-6937-4f2b-bc7f-562533cdf2b7) From 0958aec2be18b11343a10965b9a3083112d803ff Mon Sep 17 00:00:00 2001 From: Sasha Jaroshevskii <72662383+jaroshevskii@users.noreply.github.com> Date: Thu, 10 Aug 2023 03:13:47 +0300 Subject: [PATCH 20/24] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 7a880b7..a08bfee 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,5 @@

A lightweight and user-friendly tool for effortlessly repeating and customizing text.

![Baner](https://github.com/jaroshevskii/repify-cli/assets/72662383/03a9702c-6937-4f2b-bc7f-562533cdf2b7) + +![Baner 2](https://github.com/jaroshevskii/repify-cli/assets/72662383/fd8b929c-a9a1-489d-b48a-1765e4a800ee) From 9b7ad5aa1c7ce4d1b71c12fd6ab182629861a0f7 Mon Sep 17 00:00:00 2001 From: jaroshevskii Date: Fri, 11 Aug 2023 19:39:11 +0300 Subject: [PATCH 21/24] Update naming --- .replit | 2 +- .vscode/launch.json | 40 +++++++++++++++---- Package.swift | 10 +++-- .../{Repify.swift => RepyfiCLI/Repyfi.swift} | 20 +++++----- Sources/{ => RepyfiCLI}/Version.swift | 4 +- 5 files changed, 51 insertions(+), 25 deletions(-) rename Sources/{Repify.swift => RepyfiCLI/Repyfi.swift} (78%) rename Sources/{ => RepyfiCLI}/Version.swift (67%) diff --git a/.replit b/.replit index e6ec80b..a790b9f 100644 --- a/.replit +++ b/.replit @@ -1,4 +1,4 @@ -run = "swift run repify --help" +run = "swift run repyfi --help" compile = "swift build || swift package clean && clear" diff --git a/.vscode/launch.json b/.vscode/launch.json index d6a2c05..f5ecb0a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,11 +6,11 @@ "sourceLanguages": [ "swift" ], - "name": "Debug repify", - "program": "${workspaceFolder:repify-cli}/.build/debug/repify", + "name": "Debug RepyfiCLI", + "program": "${workspaceFolder:repyfi-cli}/.build/debug/RepyfiCLI", "args": [], - "cwd": "${workspaceFolder:repify-cli}", - "preLaunchTask": "swift: Build Debug repify" + "cwd": "${workspaceFolder:repyfi-cli}", + "preLaunchTask": "swift: Build Debug RepyfiCLI" }, { "type": "lldb", @@ -18,11 +18,35 @@ "sourceLanguages": [ "swift" ], - "name": "Release repify", - "program": "${workspaceFolder:repify-cli}/.build/release/repify", + "name": "Release RepyfiCLI", + "program": "${workspaceFolder:repyfi-cli}/.build/release/RepyfiCLI", "args": [], - "cwd": "${workspaceFolder:repify-cli}", - "preLaunchTask": "swift: Build Release repify" + "cwd": "${workspaceFolder:repyfi-cli}", + "preLaunchTask": "swift: Build Release RepyfiCLI" + }, + { + "type": "lldb", + "request": "launch", + "sourceLanguages": [ + "swift" + ], + "name": "Debug repyfi", + "program": "${workspaceFolder:repyfi-cli}/.build/debug/repyfi", + "args": [], + "cwd": "${workspaceFolder:repyfi-cli}", + "preLaunchTask": "swift: Build Debug repyfi" + }, + { + "type": "lldb", + "request": "launch", + "sourceLanguages": [ + "swift" + ], + "name": "Release repyfi", + "program": "${workspaceFolder:repyfi-cli}/.build/release/repyfi", + "args": [], + "cwd": "${workspaceFolder:repyfi-cli}", + "preLaunchTask": "swift: Build Release repyfi" } ] } \ No newline at end of file diff --git a/Package.swift b/Package.swift index 8e0df73..a347303 100644 --- a/Package.swift +++ b/Package.swift @@ -4,7 +4,10 @@ import PackageDescription let package = Package( - name: "RepifyCLI", + name: "RepyfiCLI", + products: [ + .executable(name: "repyfi", targets: ["RepyfiCLI"]) + ], dependencies: [ .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.0.0"), ], @@ -12,8 +15,7 @@ let package = Package( // Targets are the basic building blocks of a package, defining a module or a test suite. // Targets can depend on other targets in this package and products from dependencies. .executableTarget( - name: "repify", - dependencies: [.product(name: "ArgumentParser", package: "swift-argument-parser")], - path: "Sources"), + name: "RepyfiCLI", + dependencies: [.product(name: "ArgumentParser", package: "swift-argument-parser")]), ] ) diff --git a/Sources/Repify.swift b/Sources/RepyfiCLI/Repyfi.swift similarity index 78% rename from Sources/Repify.swift rename to Sources/RepyfiCLI/Repyfi.swift index 913bed4..8ebfc2c 100644 --- a/Sources/Repify.swift +++ b/Sources/RepyfiCLI/Repyfi.swift @@ -1,6 +1,6 @@ // -// Repify.swift -// RepifyCLI +// Repyfi.swift +// RepyfiCLI // import ArgumentParser @@ -8,21 +8,21 @@ import Foundation /// A lightweight and user-friendly tool for effortlessly repeating and customizing text. @main -struct Repify: ParsableCommand { +struct Repyfi: ParsableCommand { static let configuration = CommandConfiguration( abstract: "A lightweight and user-friendly tool for effortlessly repeating and customizing text.", discussion: """ - With Repify CLI, you can unleash your creativity by easily creating endless variations of text with just a few simple commands. + With Repyfi CLI, you can unleash your creativity by easily creating endless variations of text with just a few simple commands. LINKS: - Website: https://jaroshevskii.github.io/repify-cli/ - Discussions: https://github.com/jaroshevskii/repify-cli/discussions - Issues: https://github.com/jaroshevskii/repify-cli/issues - Repository: https://github.com/jaroshevskii/repify-cli + Website: https://repyfi.github.io + Discussions: https://github.com/repyfi/repyfi-cli/discussions + Issues: https://github.com/repyfi/repyfi-cli/issues + Repository: https://github.com/repyfi/repyfi-cli """, version: """ - Repify CLI version \(version) - Release: https://github.com/jaroshevskii/repify-cli/releases/tag/v\(version) + Repyfi CLI version \(version) + Release: https://github.com/repyfi/repyfi-cli/releases/tag/v\(version) """ ) diff --git a/Sources/Version.swift b/Sources/RepyfiCLI/Version.swift similarity index 67% rename from Sources/Version.swift rename to Sources/RepyfiCLI/Version.swift index 81df5f5..82ddbae 100644 --- a/Sources/Version.swift +++ b/Sources/RepyfiCLI/Version.swift @@ -1,8 +1,8 @@ // // Version.swift -// RepifyCLI +// RepyfiCLI // -extension Repify { +extension Repyfi { static let version = "1.0.0-rebuild" } From 18cefdda51be133543bd1c63583c795bf915bcaa Mon Sep 17 00:00:00 2001 From: jaroshevskii Date: Fri, 11 Aug 2023 20:19:16 +0300 Subject: [PATCH 22/24] Update launch.json --- .vscode/launch.json | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index f5ecb0a..8c1e756 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,29 +1,5 @@ { "configurations": [ - { - "type": "lldb", - "request": "launch", - "sourceLanguages": [ - "swift" - ], - "name": "Debug RepyfiCLI", - "program": "${workspaceFolder:repyfi-cli}/.build/debug/RepyfiCLI", - "args": [], - "cwd": "${workspaceFolder:repyfi-cli}", - "preLaunchTask": "swift: Build Debug RepyfiCLI" - }, - { - "type": "lldb", - "request": "launch", - "sourceLanguages": [ - "swift" - ], - "name": "Release RepyfiCLI", - "program": "${workspaceFolder:repyfi-cli}/.build/release/RepyfiCLI", - "args": [], - "cwd": "${workspaceFolder:repyfi-cli}", - "preLaunchTask": "swift: Build Release RepyfiCLI" - }, { "type": "lldb", "request": "launch", From 3d65c8205af6ee113abc587d9fb26dca19475380 Mon Sep 17 00:00:00 2001 From: Sasha Jaroshevskii <72662383+jaroshevskii@users.noreply.github.com> Date: Wed, 27 Sep 2023 03:36:09 +0300 Subject: [PATCH 23/24] Rebuild README.md --- README.md | 149 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 147 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a08bfee..6a02733 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,151 @@

Repify CLI

A lightweight and user-friendly tool for effortlessly repeating and customizing text.

-![Baner](https://github.com/jaroshevskii/repify-cli/assets/72662383/03a9702c-6937-4f2b-bc7f-562533cdf2b7) + -![Baner 2](https://github.com/jaroshevskii/repify-cli/assets/72662383/fd8b929c-a9a1-489d-b48a-1765e4a800ee) +![Baner](https://github.com/jaroshevskii/repify-cli/assets/72662383/fd8b929c-a9a1-489d-b48a-1765e4a800ee) + +## Installation + +Repyfi CLI is not yet available in any package manager and there are no compiled versions 😮‍💨. So you have to compile manually. + +## Usage + +Repyfi CLI is a CLI application, this means that the **application must be executed from the [Terminal](https://en.wikipedia.org/wiki/Terminal_emulator)**. + +### Basic repetition + +Use `repyfi ` to repeat the text. Where `` is your text. + +```zsh +repyfi Hello +``` + +**Result:** + +```zsh +% repyfi Hello +Hello +Hello +``` + +To repeat several words or even whole sentences, the text must be wrapped with an `'` or `"` symbol on both sides. + +```zsh +repyfi 'Be faster 🐢' +``` + +**Result:** + +```zsh +% repyfi 'Be faster 🐢' +Be faster 🐢 +Be faster 🐢 +``` + +> **Note:** If `` is missing you will get this error: +> +> ```zsh +> Error: Missing expected argument '' +> ``` + +### Number of repetition + +By default, the text will be repeated only twice. + +To set a custom number of repetitions, use `--count ` option. Where `` is a number. + +```zsh +repyfi 'I promise to always use UTF-8 🐶' --count 5 +``` + +> **Note:** You can also use shorter entry. +> +> ```zsh +> repyfi 'I promise to always use UTF-8 🐶' -c 5 +> ``` + +**Result:** + +```zsh +% repyfi 'I promise to always use UTF-8 🐶' --count 5 +I promise to always use UTF-8 🐶 +I promise to always use UTF-8 🐶 +I promise to always use UTF-8 🐶 +I promise to always use UTF-8 🐶 +I promise to always use UTF-8 🐶 +``` + +> **Note:** `` must be greater than zero. Otherwise you will get this error: +> +> ```zsh +> Error: 'count' must be greater than zero. +> ``` + +### Repetition counter + +To include a repetition counter, use `--include-counter` option. + +```zsh +repyfi 'Yare yare daze...' --count 3 --include-counter +``` +> **Note:** You can also use shorter entry. +> +> ```zsh +> repyfi 'Yare yare daze...' -c 3 -i +> ``` + +**Result:** + +```zsh +% repyfi 'Yare yare daze...' --count 3 --include-counter +1: Yare yare daze... +2: Yare yare daze... +3: Yare yare daze... +``` + +### Multiline + +Multiline may be useful if you need to repeat a text that consists of several lines, or write an arguments in a more readable version. + +To use multilining, you must use `\` as if it were a newline character. + +```zsh +repyfi 'Dum-dum-dum-dum, ditty dum-dum-dum \ +Dum, dum, dum' +``` + +**Result:** + +```zsh +% repyfi 'Dum-dum-dum-dum, ditty dum-dum-dum \ +Dum, dum, dum' +Dum-dum-dum-dum, ditty dum-dum-dum +Dum, dum, dum +Dum-dum-dum-dum, ditty dum-dum-dum +Dum, dum, dum +``` + +### Arguments order does not matter + +Rpyfi CLI uses the following order of arguments: + +``` + [--count ] [--include-counter] +``` + +But that doesn't mean you have to follow it. **Any combination of arguments will be correct.** + +The following commands will work the same way: + +- `repyfi --count 1 --include-counter 'Hello everyone!'` +- `repyfi -с 1 'Hello everyone!' --include-counter ` +- `repyfi -i --count 1 'Hello everyone!'` + +## Contributing + +Interested in contributing to Repyfi CLI? We'd love your help. Repyfi CLI is an open source project, built one contribution at a time by users like you. + +## License + +Licensed under the [MIT License](LICENSE.md). From af063adf674f58f686ef38e9dc823b907ef96bf9 Mon Sep 17 00:00:00 2001 From: Sasha Jaroshevskii <72662383+jaroshevskii@users.noreply.github.com> Date: Thu, 14 Dec 2023 03:21:28 +0200 Subject: [PATCH 24/24] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6a02733..c6f71a2 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ Dum-dum-dum-dum, ditty dum-dum-dum Dum, dum, dum ``` -### Arguments order does not matter +### Arguments order Rpyfi CLI uses the following order of arguments: