Skip to content

Commit 9ddc06f

Browse files
committed
use the same prompt for strings
1 parent 6ab98c9 commit 9ddc06f

29 files changed

+264
-264
lines changed

docs/command-reference/strings/append.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ APPEND key value
4040
Appending a value to an existing key:
4141

4242
```shell
43-
dragonfly> SET mystring "Hello"
43+
dragonfly$> SET mystring "Hello"
4444
OK
45-
dragonfly> APPEND mystring " World"
45+
dragonfly$> APPEND mystring " World"
4646
(integer) 11
47-
dragonfly> GET mystring
47+
dragonfly$> GET mystring
4848
"Hello World"
4949
```
5050

@@ -53,11 +53,11 @@ dragonfly> GET mystring
5353
Accumulating log entries for a simple logging mechanism:
5454

5555
```shell
56-
dragonfly> APPEND log "2023-07-26 10:00:00 - User login\n"
56+
dragonfly$> APPEND log "2023-07-26 10:00:00 - User login\n"
5757
(integer) 33
58-
dragonfly> APPEND log "2023-07-26 10:05:00 - User logout\n"
58+
dragonfly$> APPEND log "2023-07-26 10:05:00 - User logout\n"
5959
(integer) 66
60-
dragonfly> GET log
60+
dragonfly$> GET log
6161
"2023-07-26 10:00:00 - User login\n2023-07-26 10:05:00 - User logout\n"
6262
```
6363

@@ -66,13 +66,13 @@ dragonfly> GET log
6666
Building a configuration file or script incrementally:
6767

6868
```shell
69-
dragonfly> APPEND config "server {\n"
69+
dragonfly$> APPEND config "server {\n"
7070
(integer) 9
71-
dragonfly> APPEND config " listen 80;\n"
71+
dragonfly$> APPEND config " listen 80;\n"
7272
(integer) 22
73-
dragonfly> APPEND config "}\n"
73+
dragonfly$> APPEND config "}\n"
7474
(integer) 24
75-
dragonfly> GET config
75+
dragonfly$> GET config
7676
"server {\n listen 80;\n}\n"
7777
```
7878

@@ -86,9 +86,9 @@ dragonfly> GET config
8686
- Appending to a key that holds a non-string value can result in an error. Always ensure the data type compatibility.
8787

8888
```shell
89-
dragonfly> LPUSH mylist "item"
89+
dragonfly$> LPUSH mylist "item"
9090
(integer) 1
91-
dragonfly> APPEND mylist "string"
91+
dragonfly$> APPEND mylist "string"
9292
(error) WRONGTYPE Operation against a key holding the wrong kind of value
9393
```
9494

docs/command-reference/strings/bitcount.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ Count all set bits in a string:
4242
# String: example
4343
# Hex: 0x65 0x78 0x61 0x6d 0x70 0x6c 0x65
4444
# Binary: 01100101 01111000 01100001 01101101 01110000 01101100 01100101
45-
dragonfly> SET mykey "example"
45+
dragonfly$> SET mykey "example"
4646
OK
47-
dragonfly> BITCOUNT mykey
47+
dragonfly$> BITCOUNT mykey
4848
(integer) 27
4949
```
5050

@@ -56,9 +56,9 @@ Count bits from the second to the fourth byte:
5656
# String: example
5757
# Hex: 0x65 0x78 0x61 0x6d 0x70 0x6c 0x65
5858
# Binary: 01100101 01111000 01100001 01101101 01110000 01101100 01100101
59-
dragonfly> SET mykey "example"
59+
dragonfly$> SET mykey "example"
6060
OK
61-
dragonfly> BITCOUNT mykey 1 3
61+
dragonfly$> BITCOUNT mykey 1 3
6262
(integer) 12
6363
```
6464

@@ -69,9 +69,9 @@ Imagine you have a feature flag system where each bit represents whether a featu
6969
```shell
7070
# Hex: 0x01 0x02 0x04
7171
# Binary: 00000001 00000010 00000100
72-
dragonfly> SET features "\x01\x02\x04"
72+
dragonfly$> SET features "\x01\x02\x04"
7373
OK
74-
dragonfly> BITCOUNT features
74+
dragonfly$> BITCOUNT features
7575
(integer) 3 # Three features are enabled across different users.
7676
```
7777

docs/command-reference/strings/bitfield.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ BITFIELD key [GET type offset]
5454
### Basic Example
5555

5656
```shell
57-
dragonfly> BITFIELD mykey SET u8 0 100
57+
dragonfly$> BITFIELD mykey SET u8 0 100
5858
1) (integer) 0
59-
dragonfly> BITFIELD mykey GET u8 0
59+
dragonfly$> BITFIELD mykey GET u8 0
6060
1) (integer) 100
6161
```
6262

@@ -65,13 +65,13 @@ dragonfly> BITFIELD mykey GET u8 0
6565
Using `BITFIELD` to implement an 8-bit counter:
6666

6767
```shell
68-
dragonfly> BITFIELD mycounter INCRBY u8 0 1
68+
dragonfly$> BITFIELD mycounter INCRBY u8 0 1
6969
1) (integer) 1
70-
dragonfly> BITFIELD mycounter INCRBY u8 0 1
70+
dragonfly$> BITFIELD mycounter INCRBY u8 0 1
7171
1) (integer) 2
72-
dragonfly> BITFIELD mycounter INCRBY u8 0 253
72+
dragonfly$> BITFIELD mycounter INCRBY u8 0 253
7373
1) (integer) 255
74-
dragonfly> BITFIELD mycounter INCRBY u8 0 1
74+
dragonfly$> BITFIELD mycounter INCRBY u8 0 1
7575
1) (integer) 0 # Overflow occurs as it wraps around.
7676
```
7777

@@ -80,13 +80,13 @@ dragonfly> BITFIELD mycounter INCRBY u8 0 1
8080
Using `BITFIELD` to manage multiple flags within a single key:
8181

8282
```shell
83-
dragonfly> BITFIELD user_flags SET u1 0 1
83+
dragonfly$> BITFIELD user_flags SET u1 0 1
8484
1) (integer) 0
85-
dragonfly> BITFIELD user_flags SET u1 1 1
85+
dragonfly$> BITFIELD user_flags SET u1 1 1
8686
1) (integer) 0
87-
dragonfly> BITFIELD user_flags GET u1 0
87+
dragonfly$> BITFIELD user_flags GET u1 0
8888
1) (integer) 1
89-
dragonfly> BITFIELD user_flags GET u1 1
89+
dragonfly$> BITFIELD user_flags GET u1 1
9090
1) (integer) 1
9191
```
9292

docs/command-reference/strings/bitfield_ro.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ The command returns an array of integers, where each integer corresponds to the
4141
Retrieve an unsigned 8-bit integer (starting at offset `0`) and a signed 16-bit integer (starting at offset `8`).
4242

4343
```shell
44-
dragonfly> SET mystring "\x01\x02\x03"
44+
dragonfly$> SET mystring "\x01\x02\x03"
4545
OK
46-
dragonfly> BITFIELD_RO mystring GET u8 0 GET i16 8
46+
dragonfly$> BITFIELD_RO mystring GET u8 0 GET i16 8
4747
1) (integer) 1
4848
2) (integer) 515
4949
```
@@ -54,9 +54,9 @@ In this example, we extract multiple bitfields from a single string.
5454
This demonstrates how to handle different offsets and encodings.
5555

5656
```shell
57-
dragonfly> SET mystring "\xFF\xFE\xFD"
57+
dragonfly$> SET mystring "\xFF\xFE\xFD"
5858
OK
59-
dragonfly> BITFIELD_RO mystring GET u8 0 GET u8 8 GET i16 16
59+
dragonfly$> BITFIELD_RO mystring GET u8 0 GET u8 8 GET i16 16
6060
1) (integer) 255
6161
2) (integer) 254
6262
3) (integer) -3
@@ -67,9 +67,9 @@ dragonfly> BITFIELD_RO mystring GET u8 0 GET u8 8 GET i16 16
6767
Extracting larger bitfields, such as 32-bit integers, to demonstrate handling of wider data.
6868

6969
```shell
70-
dragonfly> SET mystring "\x00\x00\x00\x01\x00\x00\x00\x02"
70+
dragonfly$> SET mystring "\x00\x00\x00\x01\x00\x00\x00\x02"
7171
OK
72-
dragonfly> BITFIELD_RO mystring GET u32 0 GET u32 32
72+
dragonfly$> BITFIELD_RO mystring GET u32 0 GET u32 32
7373
1) (integer) 1
7474
2) (integer) 2
7575
```

docs/command-reference/strings/bitop.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ Returns the size of the string stored in the destination key, measured in bytes.
4040
Performing a basic bitwise `AND` operation between two keys:
4141

4242
```shell
43-
dragonfly> SET key1 "foobar"
43+
dragonfly$> SET key1 "foobar"
4444
OK
45-
dragonfly> SET key2 "abcdef"
45+
dragonfly$> SET key2 "abcdef"
4646
OK
47-
dragonfly> BITOP AND result key1 key2
47+
dragonfly$> BITOP AND result key1 key2
4848
(integer) 6
49-
dragonfly> GET result
49+
dragonfly$> GET result
5050
"\x60\x60\x04\x00\x00\x00"
5151
```
5252

@@ -55,15 +55,15 @@ dragonfly> GET result
5555
Combining three keys using the `OR` operation:
5656

5757
```shell
58-
dragonfly> SET key1 "\x01"
58+
dragonfly$> SET key1 "\x01"
5959
OK
60-
dragonfly> SET key2 "\x02"
60+
dragonfly$> SET key2 "\x02"
6161
OK
62-
dragonfly> SET key3 "\x03"
62+
dragonfly$> SET key3 "\x03"
6363
OK
64-
dragonfly> BITOP OR result key1 key2 key3
64+
dragonfly$> BITOP OR result key1 key2 key3
6565
(integer) 1
66-
dragonfly> GET result
66+
dragonfly$> GET result
6767
"\x03"
6868
```
6969

@@ -72,13 +72,13 @@ dragonfly> GET result
7272
Using the `XOR` operation to combine two keys:
7373

7474
```shell
75-
dragonfly> SET key1 "\x0F"
75+
dragonfly$> SET key1 "\x0F"
7676
OK
77-
dragonfly> SET key2 "\xF0"
77+
dragonfly$> SET key2 "\xF0"
7878
OK
79-
dragonfly> BITOP XOR result key1 key2
79+
dragonfly$> BITOP XOR result key1 key2
8080
(integer) 1
81-
dragonfly> GET result
81+
dragonfly$> GET result
8282
"\xFF"
8383
```
8484

@@ -87,11 +87,11 @@ dragonfly> GET result
8787
Performing the `NOT` operation on a single key:
8888

8989
```shell
90-
dragonfly> SET key1 "\xAA" # 10101010 in binary
90+
dragonfly$> SET key1 "\xAA" # 10101010 in binary
9191
OK
92-
dragonfly> BITOP NOT result key1
92+
dragonfly$> BITOP NOT result key1
9393
(integer) 1
94-
dragonfly> GET result
94+
dragonfly$> GET result
9595
"\x55" # 01010101 in binary (inverted bits)
9696
```
9797

docs/command-reference/strings/bitpos.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ In this example, we will find the first occurrence of `1` in the string:
4545
# String: example
4646
# Hex: 0x65 0x78 0x61 0x6d 0x70 0x6c 0x65
4747
# Binary: 01100101 01111000 01100001 01101101 01110000 01101100 01100101
48-
dragonfly> SET mykey "example"
48+
dragonfly$> SET mykey "example"
4949
OK
50-
dragonfly> BITPOS mykey 1
50+
dragonfly$> BITPOS mykey 1
5151
(integer) 1
5252
```
5353
@@ -58,9 +58,9 @@ The first occurrence of a `1` happens at bit position 1. (Remember, positions ar
5858
Similarly, we can find the first occurrence of a `0` bit in the string:
5959
6060
```shell
61-
dragonfly> SET mykey "example"
61+
dragonfly$> SET mykey "example"
6262
OK
63-
dragonfly> BITPOS mykey 0
63+
dragonfly$> BITPOS mykey 0
6464
(integer) 0
6565
```
6666
@@ -74,9 +74,9 @@ We can specify a search range within bytes to limit the search. The following ex
7474
# String: example
7575
# Hex: 0x65 0x78 0x61 0x6d 0x70 0x6c 0x65
7676
# Binary: 01100101 01111000 01100001 01101101 01110000 01101100 01100101
77-
dragonfly> SET mykey "example"
77+
dragonfly$> SET mykey "example"
7878
OK
79-
dragonfly> BITPOS mykey 1 1 3
79+
dragonfly$> BITPOS mykey 1 1 3
8080
(integer) 9
8181
```
8282
@@ -89,9 +89,9 @@ You can also use `BITPOS` in a system where flags are represented by bits within
8989
```shell
9090
# Example binary string: 0x00 0x04 0x80
9191
# Binary: 00000000 00000100 10000000
92-
dragonfly> SET flags "\x00\x04\x80"
92+
dragonfly$> SET flags "\x00\x04\x80"
9393
OK
94-
dragonfly> BITPOS flags 1
94+
dragonfly$> BITPOS flags 1
9595
(integer) 13
9696
```
9797

docs/command-reference/strings/cl.throttle.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ An [array](https://redis.io/docs/reference/protocol-spec/#arrays) of 5 integers
3434
## Examples
3535

3636
```shell
37-
dragonfly> CL.THROTTLE USER1 0 1 10 1
37+
dragonfly$> CL.THROTTLE USER1 0 1 10 1
3838
1) (integer) 0
3939
2) (integer) 1
4040
3) (integer) 0
4141
4) (integer) -1
4242
5) (integer) 11
43-
dragonfly> CL.THROTTLE USER1 0 1 10 1
43+
dragonfly$> CL.THROTTLE USER1 0 1 10 1
4444
1) (integer) 1
4545
2) (integer) 1
4646
3) (integer) 0

docs/command-reference/strings/decr.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ The command returns the value of the key after the decrement operation.
3737
Decrement the value of a key:
3838

3939
```shell
40-
dragonfly> SET mycounter 5
40+
dragonfly$> SET mycounter 5
4141
OK
42-
dragonfly> DECR mycounter
42+
dragonfly$> DECR mycounter
4343
(integer) 4
4444
```
4545

@@ -50,7 +50,7 @@ In this example, the value of `mycounter` is decremented from `5` to `4`.
5050
If the key does not exist, `DECR` initializes the value to `0` before performing the decrement:
5151

5252
```shell
53-
dragonfly> DECR not_yet_set
53+
dragonfly$> DECR not_yet_set
5454
(integer) -1
5555
```
5656

@@ -61,15 +61,15 @@ Here, since `not_yet_set` did not previously exist, it is initialized to `0` and
6161
You can easily implement a countdown timer using `DECR`, which decrements until a limit is reached:
6262

6363
```shell
64-
dragonfly> SET countdown 10
64+
dragonfly$> SET countdown 10
6565
OK
66-
dragonfly> DECR countdown
66+
dragonfly$> DECR countdown
6767
(integer) 9
68-
dragonfly> DECR countdown
68+
dragonfly$> DECR countdown
6969
(integer) 8
70-
dragonfly> DECR countdown
70+
dragonfly$> DECR countdown
7171
(integer) 7
72-
dragonfly> DECR countdown
72+
dragonfly$> DECR countdown
7373
(integer) 6
7474
```
7575

@@ -85,9 +85,9 @@ Each `DECR` call reduces the value by `1`, simulating a countdown from `10` to `
8585
- Using `DECR` on a key that holds a non-integer, such as a string that cannot be parsed as a number. This will result in an error.
8686

8787
```shell
88-
dragonfly> SET mykey "abc"
88+
dragonfly$> SET mykey "abc"
8989
OK
90-
dragonfly> DECR mykey
90+
dragonfly$> DECR mykey
9191
(error) ERR value is not an integer or out of range
9292
```
9393

0 commit comments

Comments
 (0)