1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
<script>
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
export default {
components: {
ClipboardButton,
},
props: {
prompt: {
type: String,
required: false,
default: '',
},
command: {
type: [Array, String],
required: false,
default: '',
},
},
computed: {
lines() {
if (typeof this.command === 'string') {
return [this.command];
}
return this.command;
},
clipboard() {
return this.lines.join('');
},
},
};
</script>
<template>
<div class="gl-display-flex gl-gap-3 gl-align-items-flex-start">
<!-- eslint-disable vue/require-v-for-key-->
<pre
class="gl-w-full"
><span v-if="prompt" class="gl-user-select-none">{{ prompt }} </span><template v-for="line in lines">{{ line }}<br class="gl-user-select-none"/></template></pre>
<!-- eslint-enable vue/require-v-for-key-->
<clipboard-button :text="clipboard" :title="__('Copy')" />
</div>
</template>
|