diff --git a/.replit b/.replit
new file mode 100644
index 0000000..a790b9f
--- /dev/null
+++ b/.replit
@@ -0,0 +1,6 @@
+run = "swift run repyfi --help"
+
+compile = "swift build || swift package clean && clear"
+
+[nix]
+channel = "stable-22_11"
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..8c1e756
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,28 @@
+{
+ "configurations": [
+ {
+ "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 8e4bbdf..a347303 100644
--- a/Package.swift
+++ b/Package.swift
@@ -1,21 +1,21 @@
-// swift-tools-version: 5.6
+// swift-tools-version: 5.4
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
- name: "RepeatCLI",
+ name: "RepyfiCLI",
+ products: [
+ .executable(name: "repyfi", targets: ["RepyfiCLI"])
+ ],
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: "RepyfiCLI",
+ dependencies: [.product(name: "ArgumentParser", package: "swift-argument-parser")]),
]
)
diff --git a/README.md b/README.md
index 279412d..c6f71a2 100644
--- a/README.md
+++ b/README.md
@@ -1,63 +1,30 @@
-
-
Repify CLI
-
- A lightweight and user-friendly command-line application designed for text repeating.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+Repify CLI
+A lightweight and user-friendly tool for effortlessly repeating and customizing text.
+
+
+
+
## Installation
-RepeatCLI is not yet available in any package manager and there are no compiled versions 😮💨. So you have to compile manually.
+Repyfi CLI 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)**.
+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 `repeat-cli ` to repeat the text. Where `` is your text.
+Use `repyfi ` to repeat the text. Where `` is your text.
```zsh
-repeat-cli Hello
+repyfi Hello
```
**Result:**
```zsh
-% repeat-cli Hello
+% repyfi Hello
Hello
Hello
```
@@ -65,13 +32,13 @@ 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 🐢'
+repyfi 'Be faster 🐢'
```
**Result:**
```zsh
-% repeat-cli 'Be faster 🐢'
+% repyfi 'Be faster 🐢'
Be faster 🐢
Be faster 🐢
```
@@ -89,19 +56,19 @@ 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
+repyfi '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
+> repyfi 'I promise to always use UTF-8 🐶' -c 5
> ```
**Result:**
```zsh
-% repeat-cli 'I promise to always use UTF-8 🐶' --count 5
+% 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 🐶
@@ -120,18 +87,18 @@ I promise to always use UTF-8 🐶
To include a repetition counter, use `--include-counter` option.
```zsh
-repeat-cli 'Yare yare daze...' --count 3 --include-counter
+repyfi 'Yare yare daze...' --count 3 --include-counter
```
> **Note:** You can also use shorter entry.
>
> ```zsh
-> repeat-cli 'Yare yare daze...' -c 3 -i
+> repyfi 'Yare yare daze...' -c 3 -i
> ```
**Result:**
```zsh
-% repeat-cli 'Yare yare daze...' --count 3 --include-counter
+% repyfi 'Yare yare daze...' --count 3 --include-counter
1: Yare yare daze...
2: Yare yare daze...
3: Yare yare daze...
@@ -144,24 +111,24 @@ Multiline may be useful if you need to repeat a text that consists of several li
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'
+repyfi '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'
+% 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
+### Arguments order
-RepeatCLI uses the following order of arguments:
+Rpyfi CLI uses the following order of arguments:
```
[--count ] [--include-counter]
@@ -171,14 +138,14 @@ But that doesn't mean you have to follow it. **Any combination of arguments will
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!'`
+- `repyfi --count 1 --include-counter 'Hello everyone!'`
+- `repyfi -с 1 'Hello everyone!' --include-counter `
+- `repyfi -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.
+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).
+Licensed under the [MIT License](LICENSE.md).
diff --git a/Sources/RepyfiCLI/Repyfi.swift b/Sources/RepyfiCLI/Repyfi.swift
new file mode 100644
index 0000000..8ebfc2c
--- /dev/null
+++ b/Sources/RepyfiCLI/Repyfi.swift
@@ -0,0 +1,74 @@
+//
+// Repyfi.swift
+// RepyfiCLI
+//
+
+import ArgumentParser
+import Foundation
+
+/// A lightweight and user-friendly tool for effortlessly repeating and customizing text.
+@main
+struct Repyfi: ParsableCommand {
+ static let configuration = CommandConfiguration(
+ abstract: "A lightweight and user-friendly tool for effortlessly repeating and customizing text.",
+ discussion: """
+ With Repyfi CLI, you can unleash your creativity by easily creating endless variations of text with just a few simple commands.
+
+ LINKS:
+ 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: """
+ Repyfi CLI version \(version)
+ Release: https://github.com/repyfi/repyfi-cli/releases/tag/v\(version)
+ """
+ )
+
+ /// The text to be repeated.
+ @Argument(help: "The text to be repeated.")
+ var text: String
+
+ /// The number of text repetitions.
+ @Option(name: .shortAndLong, help: "The number of text repetitions.")
+ var count = 2
+
+ /// 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"
+
+ /// 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 {
+ var formattedText: String
+ if let format = format {
+ formattedText = format
+ .replacingOccurrences(of: "\\(text)", with: text)
+ .replacingOccurrences(of: "\\(number)", with: "\(i)")
+ } else {
+ formattedText = includeNumbering ? "\(i): \(text)" : text
+ }
+
+ if i < count {
+ print(formattedText, terminator: separator)
+ if let delay = delay {
+ Thread.sleep(forTimeInterval: delay)
+ }
+ } else {
+ print(formattedText)
+ }
+ }
+ }
+}
diff --git a/Sources/RepyfiCLI/Version.swift b/Sources/RepyfiCLI/Version.swift
new file mode 100644
index 0000000..82ddbae
--- /dev/null
+++ b/Sources/RepyfiCLI/Version.swift
@@ -0,0 +1,8 @@
+//
+// Version.swift
+// RepyfiCLI
+//
+
+extension Repyfi {
+ static let version = "1.0.0-rebuild"
+}
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
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