mirror of
https://github.com/CorentinTh/it-tools.git
synced 2024-09-11 13:37:53 +03:00
Merge 4b6184a7a0
into 76a19d218d
This commit is contained in:
commit
adbed7372c
129
src/tools/curl-generator/curl-generator.vue
Normal file
129
src/tools/curl-generator/curl-generator.vue
Normal file
@ -0,0 +1,129 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
toAnsible, toAnsibleWarn, toCFML, toCFMLWarn, toCSharp, toCSharpWarn,
|
||||
toClojure, toClojureWarn, toDart, toDartWarn, toElixir, toElixirWarn, toGo, toGoWarn,
|
||||
toHTTP, toHTTPWarn, toHarString, toHarStringWarn, toHttpie, toHttpieWarn, toJava, toJavaHttpUrlConnection,
|
||||
toJavaHttpUrlConnectionWarn, toJavaJsoup, toJavaJsoupWarn, toJavaOkHttp, toJavaOkHttpWarn,
|
||||
toJavaScript, toJavaScriptJquery, toJavaScriptJqueryWarn, toJavaScriptWarn, toJavaScriptXHR, toJavaScriptXHRWarn,
|
||||
toJavaWarn, toJsonString, toJsonStringWarn, toJulia, toJuliaWarn, toKotlin, toKotlinWarn, toLua, toLuaWarn,
|
||||
toMATLAB, toMATLABWarn, toNode, toNodeAxios, toNodeAxiosWarn, toNodeGot, toNodeGotWarn, toNodeHttp, toNodeHttpWarn,
|
||||
toNodeKy, toNodeKyWarn, toNodeRequest, toNodeRequestWarn, toNodeSuperAgent, toNodeSuperAgentWarn, toNodeWarn,
|
||||
toOCaml, toOCamlWarn, toObjectiveC, toObjectiveCWarn, toPerl, toPerlWarn, toPhp, toPhpGuzzle, toPhpGuzzleWarn,
|
||||
toPhpRequests, toPhpRequestsWarn, toPhpWarn, toPowershellRestMethod, toPowershellRestMethodWarn,
|
||||
toPowershellWebRequest, toPowershellWebRequestWarn, toPython, toPythonHttp, toPythonHttpWarn, toPythonWarn, toR,
|
||||
toRWarn, toRuby, toRubyWarn, toRust, toRustWarn, toSwift, toSwiftWarn, toWget, toWgetWarn,
|
||||
} from 'curlconverter';
|
||||
|
||||
const translate = {
|
||||
'ansible': [toAnsible, toAnsibleWarn],
|
||||
'cfml': [toCFML, toCFMLWarn],
|
||||
'clojure': [toClojure, toClojureWarn],
|
||||
'csharp': [toCSharp, toCSharpWarn],
|
||||
'c#': [toCSharp, toCSharpWarn],
|
||||
'browser': [toJavaScript, toJavaScriptWarn],
|
||||
'dart': [toDart, toDartWarn],
|
||||
'elixir': [toElixir, toElixirWarn],
|
||||
'go': [toGo, toGoWarn],
|
||||
'golang': [toGo, toGoWarn],
|
||||
'har': [toHarString, toHarStringWarn],
|
||||
'http': [toHTTP, toHTTPWarn],
|
||||
'httpie': [toHttpie, toHttpieWarn],
|
||||
'java': [toJava, toJavaWarn],
|
||||
'java-httpurlconnection': [
|
||||
toJavaHttpUrlConnection,
|
||||
toJavaHttpUrlConnectionWarn,
|
||||
],
|
||||
'java-jsoup': [toJavaJsoup, toJavaJsoupWarn],
|
||||
'java-okhttp': [toJavaOkHttp, toJavaOkHttpWarn],
|
||||
'javascript': [toJavaScript, toJavaScriptWarn],
|
||||
'javascript-axios': [toNodeAxios, toNodeAxiosWarn],
|
||||
'javascript-fetch': [toJavaScript, toJavaScriptWarn],
|
||||
'javascript-got': [toNodeGot, toNodeGotWarn],
|
||||
'javascript-ky': [toNodeKy, toNodeKyWarn],
|
||||
'javascript-jquery': [toJavaScriptJquery, toJavaScriptJqueryWarn],
|
||||
'javascript-request': [toNodeRequest, toNodeRequestWarn],
|
||||
'javascript-superagent': [toNodeSuperAgent, toNodeSuperAgentWarn],
|
||||
'javascript-xhr': [toJavaScriptXHR, toJavaScriptXHRWarn],
|
||||
'json': [toJsonString, toJsonStringWarn],
|
||||
'julia': [toJulia, toJuliaWarn],
|
||||
'kotlin': [toKotlin, toKotlinWarn],
|
||||
'lua': [toLua, toLuaWarn],
|
||||
'matlab': [toMATLAB, toMATLABWarn],
|
||||
'node': [toNode, toNodeWarn],
|
||||
'node-axios': [toNodeAxios, toNodeAxiosWarn],
|
||||
'node-fetch': [toNode, toNodeWarn],
|
||||
'node-got': [toNodeGot, toNodeGotWarn],
|
||||
'node-http': [toNodeHttp, toNodeHttpWarn],
|
||||
'node-ky': [toNodeKy, toNodeKyWarn],
|
||||
'node-jquery': [toJavaScriptJquery, toJavaScriptJqueryWarn],
|
||||
'node-request': [toNodeRequest, toNodeRequestWarn],
|
||||
'node-superagent': [toNodeSuperAgent, toNodeSuperAgentWarn],
|
||||
'node-xhr': [toJavaScriptXHR, toJavaScriptXHRWarn],
|
||||
'nodejs': [toNode, toNodeWarn],
|
||||
'nodejs-axios': [toNodeAxios, toNodeAxiosWarn],
|
||||
'nodejs-fetch': [toNode, toNodeWarn],
|
||||
'nodejs-got': [toNodeGot, toNodeGotWarn],
|
||||
'nodejs-http': [toNodeHttp, toNodeHttpWarn],
|
||||
'nodejs-ky': [toNodeKy, toNodeKyWarn],
|
||||
'nodejs-jquery': [toJavaScriptJquery, toJavaScriptJqueryWarn],
|
||||
'nodejs-request': [toNodeRequest, toNodeRequestWarn],
|
||||
'nodejs-superagent': [toNodeSuperAgent, toNodeSuperAgentWarn],
|
||||
'nodejs-xhr': [toJavaScriptXHR, toJavaScriptXHRWarn],
|
||||
'objc': [toObjectiveC, toObjectiveCWarn],
|
||||
'objectivec': [toObjectiveC, toObjectiveCWarn],
|
||||
'objective-c': [toObjectiveC, toObjectiveCWarn],
|
||||
'ocaml': [toOCaml, toOCamlWarn],
|
||||
'perl': [toPerl, toPerlWarn],
|
||||
'php': [toPhp, toPhpWarn],
|
||||
'php-curl': [toPhp, toPhpWarn],
|
||||
'php-guzzle': [toPhpGuzzle, toPhpGuzzleWarn],
|
||||
'php-requests': [toPhpRequests, toPhpRequestsWarn],
|
||||
'powershell': [toPowershellRestMethod, toPowershellRestMethodWarn],
|
||||
'powershell-restmethod': [
|
||||
toPowershellRestMethod,
|
||||
toPowershellRestMethodWarn,
|
||||
],
|
||||
'powershell-webrequest': [
|
||||
toPowershellWebRequest,
|
||||
toPowershellWebRequestWarn,
|
||||
],
|
||||
'python': [toPython, toPythonWarn],
|
||||
'python-http': [toPythonHttp, toPythonHttpWarn],
|
||||
'python-httpclient': [toPythonHttp, toPythonHttpWarn],
|
||||
'r': [toR, toRWarn],
|
||||
'ruby': [toRuby, toRubyWarn],
|
||||
'rust': [toRust, toRustWarn],
|
||||
'swift': [toSwift, toSwiftWarn],
|
||||
'wget': [toWget, toWgetWarn],
|
||||
};
|
||||
|
||||
const language = ref('python');
|
||||
const curl = ref('');
|
||||
const inlang = computed(() => {
|
||||
return translate[language.value as (keyof typeof translate)][1](curl.value);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<c-input-text
|
||||
v-model:value="curl"
|
||||
size="large"
|
||||
placeholder="Your curl command"
|
||||
mb-3
|
||||
/>
|
||||
|
||||
<c-select
|
||||
v-model:value="language"
|
||||
searchable
|
||||
label="Language:"
|
||||
:options="Object.keys(translate)"
|
||||
/>
|
||||
|
||||
<n-divider />
|
||||
|
||||
<n-form-item label="Curl language equivalent:">
|
||||
<TextAreaCopyable :value="inlang" />
|
||||
</n-form-item>
|
||||
</div>
|
||||
</template>
|
12
src/tools/curl-generator/index.ts
Normal file
12
src/tools/curl-generator/index.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { ExternalLink } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Curl generator',
|
||||
path: '/curl-generator',
|
||||
description: 'Generate curl version for common coding languages',
|
||||
keywords: ['curl', 'code', 'language', 'generator'],
|
||||
component: () => import('./curl-generator.vue'),
|
||||
icon: ExternalLink,
|
||||
createdAt: new Date('2024-04-20'),
|
||||
});
|
@ -6,6 +6,7 @@ import { tool as asciiTextDrawer } from './ascii-text-drawer';
|
||||
|
||||
import { tool as textToUnicode } from './text-to-unicode';
|
||||
import { tool as safelinkDecoder } from './safelink-decoder';
|
||||
import { tool as curlGenerator } from './curl-generator';
|
||||
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
|
||||
import { tool as numeronymGenerator } from './numeronym-generator';
|
||||
import { tool as macAddressGenerator } from './mac-address-generator';
|
||||
@ -148,6 +149,7 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
dockerRunToDockerComposeConverter,
|
||||
xmlFormatter,
|
||||
yamlViewer,
|
||||
curlGenerator,
|
||||
],
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user