RepeatCLI

Swift Compatibility Platform Compatibility Platform Compatibility Windows

RepeatCLI is a simple command-line application for text repeating, based on the Example Repeat from Swift Argument Parser library.

% repeat-cli 'This text will be repeated three times with a counter 🦄' \
  --count 3 \
  --include-counter
1: This text will be repeated three times with a counter 🦄
2: This text will be repeated three times with a counter 🦄
3: This text will be repeated three times with a counter 🦄

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.

Basic repetition

Use repeat-cli <text> to repeat the text. Where <text> is your text.

repeat-cli Hello

Result:

% 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.

repeat-cli 'Be faster 🐢'

Result:

% repeat-cli 'Be faster 🐢'
Be faster 🐢
Be faster 🐢

Note: If <text> is missing you will get this error:

Error: Missing expected argument '<text>'

Number of repetition

By default, the text will be repeated only twice.

To set a custom number of repetitions, use --count <count> option. Where <count> is a number.

repeat-cli 'I promise to always use UTF-8 🐶' --count 5

Note: You can also use shorter entry.

repeat-cli 'I promise to always use UTF-8 🐶' -c 5

Result:

% 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: <count> must be greater than zero. Otherwise you will get this error:

Error: 'count' must be greater than zero.

Repetition counter

To include a repetition counter, use --include-counter option.

repeat-cli 'Yare yare daze...' --count 3 --include-counter

Note: You can also use shorter entry.

repeat-cli 'Yare yare daze...' -c 3 -i

Result:

% 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.

repeat-cli 'Dum-dum-dum-dum, ditty dum-dum-dum \
            Dum, dum, dum'

Result:

% 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:

<text> [--count <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 Slate? We'd love your help. Slate is an open source project, built one contribution at a time by users like you.

License

Licensed under the MIT License.

Description

  • Swift Tools 5.7.0
View More Packages from this Author

Dependencies

Last updated: Tue Jan 24 2023 10:49:16 GMT-0500 (GMT-05:00)