diff --git a/.vuepress/config.js b/.vuepress/config.js index 71e96e6c326..4c782e590e1 100755 --- a/.vuepress/config.js +++ b/.vuepress/config.js @@ -14,6 +14,7 @@ import { navbarEn, navbarEs, navbarJa, + navbarKoKR, navbarPtBR, navbarRU, navbarZhCN, @@ -21,6 +22,7 @@ import { sidebarEn, sidebarEs, sidebarJa, + sidebarKoKR, sidebarPtBR, sidebarRU, sidebarZhCN, @@ -60,6 +62,11 @@ export default defineUserConfig({ title: 'Nushell', description: '新しいタイプのシェル', }, + '/ko-KR/': { + lang: 'ko-KR', + title: 'Nushell', + description: '새로운 타입의 셸', + }, '/pt-BR/': { lang: 'pt-BR', title: 'Nushell', @@ -127,6 +134,13 @@ export default defineUserConfig({ navbar: navbarJa, sidebar: sidebarJa, }, + '/ko-KR/': { + selectText: '언어', + selectLanguageName: '한국어', + editLinkText: 'GitHub에서 이 페이지 편집하기', + navbar: navbarKoKR, + sidebar: sidebarKoKR, + }, '/pt-BR/': { selectText: 'Línguas', selectLanguageName: 'Português do Brasil', diff --git a/.vuepress/configs/navbar/index.ts b/.vuepress/configs/navbar/index.ts index 5703043d438..9563fdcae91 100644 --- a/.vuepress/configs/navbar/index.ts +++ b/.vuepress/configs/navbar/index.ts @@ -2,6 +2,7 @@ export * from './de.js'; export * from './en.js'; export * from './es.js'; export * from './ja.js'; +export * from './ko-KR.js'; export * from './pt-BR.js'; export * from './ru.js'; export * from './zh-CN.js'; diff --git a/.vuepress/configs/navbar/ko-KR.ts b/.vuepress/configs/navbar/ko-KR.ts new file mode 100644 index 00000000000..2a11a2f30f2 --- /dev/null +++ b/.vuepress/configs/navbar/ko-KR.ts @@ -0,0 +1,8 @@ +import type { NavbarConfig } from '@vuepress/theme-default'; + +export const navbarKoKR: NavbarConfig = [ + { text: 'Book', link: '/ko-KR/book/' }, + // { text: "Contributor Book", link: "/contributor-book/" }, + { text: 'Cookbook', link: '/cookbook/' }, + { text: '블로그', link: '/blog/' }, +]; diff --git a/.vuepress/configs/sidebar/index.ts b/.vuepress/configs/sidebar/index.ts index 5703043d438..9563fdcae91 100644 --- a/.vuepress/configs/sidebar/index.ts +++ b/.vuepress/configs/sidebar/index.ts @@ -2,6 +2,7 @@ export * from './de.js'; export * from './en.js'; export * from './es.js'; export * from './ja.js'; +export * from './ko-KR.js'; export * from './pt-BR.js'; export * from './ru.js'; export * from './zh-CN.js'; diff --git a/.vuepress/configs/sidebar/ko-KR.ts b/.vuepress/configs/sidebar/ko-KR.ts new file mode 100644 index 00000000000..cf0bceff6d7 --- /dev/null +++ b/.vuepress/configs/sidebar/ko-KR.ts @@ -0,0 +1,107 @@ +import type { SidebarConfig } from '@vuepress/theme-default'; +// import { commandCategories } from './command_categories'; + +export const sidebarKoKR: SidebarConfig = { + '/ko-KR/book/': [ + { + text: '소개', + link: '/ko-KR/book/README.md', + collapsible: false, + }, + { + text: '시작하기', + link: '/ko-KR/book/getting_started.md', + collapsible: false, + children: [ + '/ko-KR/book/installation.md', + '/ko-KR/book/default_shell.md', + '/ko-KR/book/quick_tour.md', + '/ko-KR/book/moving_around.md', + '/ko-KR/book/thinking_in_nu.md', + '/ko-KR/book/cheat_sheet.md', + ], + }, + { + text: 'Nu 기초', + link: '/ko-KR/book/nu_fundamentals.md', + collapsible: false, + children: [ + '/ko-KR/book/types_of_data.md', + '/ko-KR/book/loading_data.md', + '/ko-KR/book/pipelines.md', + '/ko-KR/book/working_with_strings.md', + '/ko-KR/book/working_with_lists.md', + '/ko-KR/book/working_with_tables.md', + ], + }, + { + text: 'Nu로 프로그래밍하기', + link: '/ko-KR/book/programming_in_nu.md', + collapsible: false, + children: [ + '/ko-KR/book/custom_commands.md', + '/ko-KR/book/aliases.md', + '/ko-KR/book/operators.md', + '/ko-KR/book/variables_and_subexpressions.md', + '/ko-KR/book/scripts.md', + '/ko-KR/book/modules.md', + '/ko-KR/book/overlays.md', + '/ko-KR/book/command_signature.md', + '/ko-KR/book/testing.md', + '/ko-KR/book/style_guide.md', + ], + }, + { + text: '셸로서의 Nu', + link: '/ko-KR/book/nu_as_a_shell.md', + collapsible: false, + children: [ + '/ko-KR/book/configuration.md', + '/ko-KR/book/environment.md', + '/ko-KR/book/stdout_stderr_exit_codes.md', + '/ko-KR/book/escaping.md', + '/ko-KR/book/3rdpartyprompts.md', + '/ko-KR/book/shells_in_shells.md', + '/ko-KR/book/line_editor.md', + '/ko-KR/book/externs.md', + '/ko-KR/book/custom_completions.md', + '/ko-KR/book/coloring_and_theming.md', + '/ko-KR/book/hooks.md', + '/ko-KR/book/background_task.md', + ], + }, + { + text: 'Nu로 전환하기', + link: '/ko-KR/book/coming_to_nu.md', + collapsible: false, + children: [ + '/ko-KR/book/coming_from_bash.md', + '/ko-KR/book/coming_from_cmd.md', + '/ko-KR/book/nushell_map.md', + '/ko-KR/book/nushell_map_imperative.md', + '/ko-KR/book/nushell_map_functional.md', + '/ko-KR/book/nushell_operator_map.md', + ], + }, + { + text: '디자인 노트', + link: '/ko-KR/book/design_notes.md', + collapsible: false, + children: ['/ko-KR/book/how_nushell_code_gets_run.md'], + }, + { + text: '(살짝) 더 깊게', + link: '/ko-KR/book/advanced.md', + collapsible: false, + children: [ + '/ko-KR/book/standard_library.md', + '/ko-KR/book/dataframes.md', + '/ko-KR/book/metadata.md', + '/ko-KR/book/creating_errors.md', + '/ko-KR/book/parallelism.md', + '/ko-KR/book/plugins.md', + '/ko-KR/book/explore.md', + ], + }, + ], +}; diff --git a/i18n-meta.json b/i18n-meta.json index 87c32feb829..0aa41a32676 100644 --- a/i18n-meta.json +++ b/i18n-meta.json @@ -6,6 +6,7 @@ "de": "translated by @sebastian-xyz", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -17,6 +18,7 @@ "de": "-", "tr": "-", "ja": "cfc7b0d@YukiOnodera", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "translated by @blezz-tech" @@ -28,6 +30,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -39,6 +42,7 @@ "de": "translated by @sebastian-xyz", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -50,6 +54,7 @@ "de": "f08ae29d@petrisch", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -61,6 +66,7 @@ "de": "93859d14ea@petrisch", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -72,6 +78,7 @@ "de": "translated by @sebastian-xyz", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -83,6 +90,7 @@ "de": "c39efa00@petrisch", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -94,6 +102,7 @@ "de": "c39efa00@petrisch", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -105,6 +114,7 @@ "de": "696cb4fe@petrisch", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -116,6 +126,7 @@ "de": "translated by @sebastian-xyz", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -127,6 +138,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -138,6 +150,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -149,6 +162,7 @@ "de": "translated by @sebastian-xyz", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -160,6 +174,7 @@ "de": "5993a92b@petrisch", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -171,6 +186,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -182,6 +198,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -193,6 +210,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -204,6 +222,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -215,6 +234,7 @@ "de": "translated by @sebastian-xyz", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -226,6 +246,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -237,6 +258,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -248,6 +270,7 @@ "de": "c39efa00@petrisch", "tr": "-", "ja": "cfc7b0d@YukiOnodera", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -259,6 +282,7 @@ "de": "13ed3117@petrisch", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -270,6 +294,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -281,6 +306,7 @@ "de": "translated by @sebastian-xyz", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -292,6 +318,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -303,6 +330,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -314,6 +342,7 @@ "de": "0c788acfec@petrisch", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -325,6 +354,7 @@ "de": " 83d74f9af2@Roshanjossey", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -336,6 +366,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -347,6 +378,7 @@ "de": "cfba017793@petrisch", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -358,6 +390,7 @@ "de": "c39efa00@petrisch", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -369,6 +402,7 @@ "de": "c39efa00@petrisch", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -380,6 +414,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -391,6 +426,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -402,6 +438,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -413,6 +450,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -424,6 +462,7 @@ "de": "c39efa00@petrisch", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -435,6 +474,7 @@ "de": "2a917adc@petrisch", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -446,6 +486,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -457,6 +498,7 @@ "de": "931d7240e2@petrisch", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -468,6 +510,7 @@ "de": "translated by @sebastian-xyz", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -479,6 +522,7 @@ "de": "c39efa00@petrisch", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -490,6 +534,7 @@ "de": "-", "tr": "-", "ja": "fcf0d7c8@yukitomoda", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -501,6 +546,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -512,6 +558,7 @@ "de": "931d7240e2@petrisch", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -523,6 +570,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -534,6 +582,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -545,6 +594,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -556,6 +606,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -567,6 +618,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -578,6 +630,7 @@ "de": "c39efa00@petrisch", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -589,6 +642,7 @@ "de": "-", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -600,6 +654,7 @@ "de": "translated by @sebastian-xyz", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -611,6 +666,7 @@ "de": "ad03c8d55c@petrisch", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -622,6 +678,7 @@ "de": "0c788acfec@petrisch", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" @@ -633,6 +690,7 @@ "de": "ad03c8d55c@petrisch", "tr": "-", "ja": "-", + "ko-KR": "-", "es": "-", "pt-BR": "-", "ru": "-" diff --git a/i18n.nu b/i18n.nu index 1651fdf955f..ee088810f92 100644 --- a/i18n.nu +++ b/i18n.nu @@ -28,6 +28,7 @@ def update-i18n-status [] { | upsert de {|it| get-cell $it.name de } | upsert tr {|it| get-cell $it.name tr } | upsert ja {|it| get-cell $it.name ja } + | upsert ko-KR {|it| get-cell $it.name ko-KR } | upsert es {|it| get-cell $it.name es } | upsert pt-BR {|it| get-cell $it.name pt-BR } | upsert ru {|it| get-cell $it.name ru } @@ -79,6 +80,7 @@ def gen-i18n-meta [] { | upsert de {|it| get-cell $it.name de } | upsert tr {|it| get-cell $it.name tr } | upsert ja {|it| get-cell $it.name ja } + | upsert ko-KR {|it| get-cell $it.name ko-KR } | upsert es {|it| get-cell $it.name es } | upsert pt-BR {|it| get-cell $it.name pt-BR } | upsert ru {|it| get-cell $it.name ru } @@ -126,7 +128,7 @@ def main [ task: string # Available task: `gen`, `update`, `outdated` lng?: string # The locale to check outdated: zh-CN, de, etc. ] { - let locales = ['zh-cn', 'de', 'tr', 'ja', 'es', 'pt-br', 'ru'] + let locales = ['zh-cn', 'de', 'tr', 'ja', 'ko-KR', 'es', 'pt-br', 'ru'] match $task { 'gen' => { gen-i18n-meta }, 'update' => { update-i18n-status }, diff --git a/ko-KR/README.md b/ko-KR/README.md new file mode 100644 index 00000000000..10d93951601 --- /dev/null +++ b/ko-KR/README.md @@ -0,0 +1,61 @@ +--- +home: true +heroImage: null +heroText: Nushell +tagline: 새로운 타입의 셸 +actionText: 시작하기 → +actionLink: /ko-KR/book/ +features: + - title: 어떤 운영체제든 제어하기 위한 파이프라인 + details: Nu는 Linux, macOS, BSD, 그리고 Windows에서 동작합니다. 한 번 배우고, 어디서든 사용하세요. + - title: 모든 것은 데이터입니다 + details: Nu 파이프라인은 언제나 안전하게 선택하고, 필터링하고, 정렬할 수 있는 구조화된 데이터를 사용합니다. 문자열 파싱은 그만두고 문제를 해결하세요. + - title: 강력한 플러그인 + details: 강력한 플러그인으로 Nu를 쉽게 확장할 수 있습니다. +--- + +Screenshot showing using the ls command + +### Nu는 기존의 데이터를 사용할 수 있습니다 + +Nu는 [JSON, YAML, SQLite, Excel 등](/book/loading_data.html)의 데이터 포맷을 지원합니다. 데이터들이 파일, 데이터베이스, 웹 API 어디에 있든지 쉽게 Nu 파이프라인에 가져올 수 있습니다. + +Screenshot showing fetch with a web API + +### Nu의 에러 메시지는 알아보기 쉽습니다 + +Nu에는 데이터 타입이 있기 때문에, 타입이 없는 다른 셸들이 잡지 못하는 버그들을 감지할 수 있습니다. 또한 만약에 오류가 발생한다면, Nu는 정확히 어디서, 왜 오류가 발생했는지 알려줍니다. + +Screenshot showing Nu catching a type error + +## Nu 사용하기 + +Nushell은 [실행 파일](https://github.com/nushell/nushell/releases)로, [패키지 매니저](https://repology.org/project/nushell/versions)를 통해, [GitHub Action](https://github.com/marketplace/actions/setup-nu)에서, 또는 [소스코드](https://github.com/nushell/nushell)로 사용할 수 있습니다. 자세한 사항은 [설치 매뉴얼](/book/installation.html) 에서 확인해 주세요. + +#### macOS / Linux: + +##### Homebrew + +```shell +$ brew install nushell +``` + +##### Nix profile + +```shell +$ nix profile install nixpkgs#nushell +``` + +#### Windows: + +```shell +$ winget install nushell +``` + +설치 후에는 `nu` 커맨드로 Nu를 실행해 주세요. + +## 커뮤니티 + +Nu에 대한 질문 사항이 있으시면 [디스코드](https://discord.gg/NtAbbGn)에 문의해 주세요! + +[피드백](https://github.com/nushell/nushell.github.io/issues) 이나 [PR](https://github.com/nushell/nushell.github.io/pulls)을 통해 이 사이트를 개선시킬 수 있습니다. diff --git a/ko-KR/book/3rdpartyprompts.md b/ko-KR/book/3rdpartyprompts.md new file mode 100644 index 00000000000..51caf472887 --- /dev/null +++ b/ko-KR/book/3rdpartyprompts.md @@ -0,0 +1,99 @@ +# 서드파티 프롬프트 설정하기 + +## nerdfonts + +nerdfonts are not required but they make the presentation much better. + +[site](https://www.nerdfonts.com) + +[repo](https://github.com/ryanoasis/nerd-fonts) + +## oh-my-posh + +[site](https://ohmyposh.dev/) + +[repo](https://github.com/JanDeDobbeleer/oh-my-posh) + +If you like [oh-my-posh](https://ohmyposh.dev/), you can use oh-my-posh with Nushell with a few steps. It works great with Nushell. How to setup oh-my-posh with Nushell: + +1. Install Oh My Posh and download oh-my-posh's themes following [guide](https://ohmyposh.dev/docs/installation/linux). +2. Download and install a [nerd font](https://github.com/ryanoasis/nerd-fonts). +3. Generate the .oh-my-posh.nu file. By default it will be generated to your home directory. You can use `--config` to specify a theme, other wise, oh-my-posh comes with a default theme. +4. Initialize oh-my-posh prompt by adding in ~/.config/nushell/config.nu(or the path output by `$nu.config-path`) to source ~/.oh-my-posh.nu. + +```nu +# Generate the .oh-my-posh.nu file +> oh-my-posh init nu --config ~/.poshthemes/M365Princess.omp.json + +# Initialize oh-my-posh.nu at shell startup by adding this line in your config.nu file +> source ~/.oh-my-posh.nu +``` + +For MacOS users: + +1. You can install oh-my-posh by `brew`, just following the [guide here](https://ohmyposh.dev/docs/installation/macos) +2. Download and install a [nerd font](https://github.com/ryanoasis/nerd-fonts). +3. Set the PROMPT_COMMAND in the file output by `$nu.config-path`, here is a code snippet: + +```nu +let posh_dir = (brew --prefix oh-my-posh | str trim) +let posh_theme = $'($posh_dir)/share/oh-my-posh/themes/' +# Change the theme names to: zash/space/robbyrussel/powerline/powerlevel10k_lean/ +# material/half-life/lambda Or double lines theme: amro/pure/spaceship, etc. +# For more [Themes demo](https://ohmyposh.dev/docs/themes) +$env.PROMPT_COMMAND = { || oh-my-posh prompt print primary --config $'($posh_theme)/zash.omp.json' } +# Optional +$env.PROMPT_INDICATOR = $"(ansi y)$> (ansi reset)" +``` + +## Starship + +[site](https://starship.rs/) + +[repo](https://github.com/starship/starship) + +1. Follow the links above and install Starship. +2. Install nerdfonts depending on your preferences. +3. Use the config example below. Make sure to set the `STARSHIP_SHELL` environment variable. + +::: tip +An alternate way to enable Starship is described in the [Starship Quick Install](https://starship.rs/#nushell) instructions. + +The link above is the official integration of Starship and Nushell and is the simplest way to get +Starship running without doing anything manual: + +- Starship will create its own configuration / environment setup script +- you simply have to create it in `env.nu` and `use` it in `config.nu` + ::: + +Here's an example config section for Starship: + +```nu +$env.STARSHIP_SHELL = "nu" + +def create_left_prompt [] { + starship prompt --cmd-duration $env.CMD_DURATION_MS $'--status=($env.LAST_EXIT_CODE)' +} + +# Use nushell functions to define your right and left prompt +$env.PROMPT_COMMAND = { || create_left_prompt } +$env.PROMPT_COMMAND_RIGHT = "" + +# The prompt indicators are environmental variables that represent +# the state of the prompt +$env.PROMPT_INDICATOR = "" +$env.PROMPT_INDICATOR_VI_INSERT = ": " +$env.PROMPT_INDICATOR_VI_NORMAL = "〉" +$env.PROMPT_MULTILINE_INDICATOR = "::: " +``` + +Now restart Nu. + +``` +nushell on 📙 main is 📦 v0.60.0 via 🦀 v1.59.0 +❯ +``` + +## Purs + +[repo](https://github.com/xcambar/purs) diff --git a/ko-KR/book/README.md b/ko-KR/book/README.md new file mode 100644 index 00000000000..d9310942fe0 --- /dev/null +++ b/ko-KR/book/README.md @@ -0,0 +1,64 @@ +# 소개 + +Nushell 프로젝트에 오신 것을 환영합니다. +이 프로젝트의 목표는 파이프로 단순한 명령들을 연결하는 유닉스 셸 철학에 현대적인 개발 스타일을 가져오는 것이 목표입니다. +따라서, 셸이나 프로그래밍 언어로서 따로 존재하는 것보다, Nushell은 하나의 패키지에 프로그래밍 언어와 셸을 모두 포함함으로써 두 역할을 모두 수행합니다. + +Nu는 bash을 비록한 전통적인 셸, Powershell 같은 오브젝트 기반 셸, TypeScript 같은 "gradually-typed" 언어, 함수형 프로그래밍, 시스템 프로그래밍 등의 많은 익숙한 영역에서 영향을 받았습니다. +하지만 Nu는 잡다하게 다재다능하기보다는, 다음과 같은 것에 집중합니다. + +- 현대적인 느낌의 유연한 크로스 플랫폼 셸이 되기 +- 데이터 구조를 활용하는 현대적인 프로그래밍 언어처럼 문제를 해결하기 +- 깔끔한 IDE 지원과 명료한 에러 메시지 제공하기 + +## This Book + +이 책은 여러 챕터와 섹션으로 구성되었습니다. +챕터 헤더를 클릭하여 자세한 정보를 확인하세요. + +- [시작하기](getting_started.md) Nushell을 설치하는 방법을 알려줍니다. 또한 Nushell이 bash와 같은 다른 셸들과 차별화되는 디자인 원리에 대해서도 설명합니다. +- [Nu 기초](nu_fundamentals.md) Nushell 언어의 기본 개념에 대해 설명합니다. +- [Nu로 프로그래밍하기](programming_in_nu.md) 언어의 기능에 대해 조금 더 깊게 살펴보고 코드를 구조화하는 여러 가지 방법에 대해 알아봅니다. +- [셸로서의 Nu](nu_as_a_shell.md) 환경 설정 등 셸로서의 기능에 초점을 맞춥니다. +- [Nu로 전환하기](coming_to_nu.md) 다른 셸이나 언어에서의 빠른 전환을 위한 방법들에 대해 설명합니다. +- [디자인 노트](design_notes.md) Nushell의 디자인에 관한 선택에 대한 깊이 있는 설명을 제공합니다. +- [(살짝) 더 깊게](advanced.md) 조금 더 심화된 주제들(그렇게 심오하진 않으니, 한번 읽어 보세요!)을 포함합니다. + +## Nushell의 구성 + +Nushell 프로젝트는 여러 개의 다른 레포지토리와 하위 프로젝트들로 구성되어 있습니다. +[Nushell GitHub organization](https://github.com/nushell)에서 모두 확인할 수 있습니다. + +- 메인 Nushell 레포지토리는 [여기](https://github.com/nushell/nushell)에 있습니다. 복수의 create들로 나누어져 있으며, 당신의 프로젝트에 별개의 라이브러리들로서 사용될 수 있습니다. +- 이 책을 포함한 [nushell.sh](https://www.nushell.sh) 페이지의 레포지토리는, [여기](https://github.com/nushell/nushell.github.io)에 있습니다. +- Nushell은 자체 개발한 [라인 에디터 라이브러리](https://github.com/nushell/reedline)가 있습니다. +- [`nu_scripts`](https://github.com/nushell/nu_scripts) 레포지토리는 패키지 매니저 를 갖추기 전에 다른 사용자들과 스크립트 또는 모듈을 공유할 수 있는 곳입니다. +- [Nana](https://github.com/nushell/nana)는 Nushell에서 그래픽 사용자 인터페이스를 실험하기 위한 레포지토리입니다. +- [Awesome Nu](https://github.com/nushell/awesome-nu) 레포지토리에는 Nushell 생태계와 호환되는 플러그인, 스크립트, 편집기 확장, 서드파티 통합 확장 프로그램들의 리스트가 있습니다. +- [Nu Showcase](https://github.com/nushell/showcase)는 Nushell에 관련한 블로그 게시물, 아트워크 등의 작업물들을 공유하는 곳입니다. +- [Request for Comment (RFC)](https://github.com/nushell/rfcs)는 주요한 설계 변경점들을 제안하고 토론할 수 있는 곳입니다. 현재 사용률이 저조하나 점점 사용하는 사람들이 많아지기를 희망하고 있습니다. + +## 기여하기 + +우리는 기여를 환영합니다! +[보시다시피](#the-many-parts-of-nushell), 여러분이 기여를 할 수 있는 곳이 많습니다. +대부분의 레포지토리들에는 기여를 시작하기 위한 팁들과 세부 사항들이 포함된 `CONTRIBUTING.md` 파일이 있습니다. (만약 없다면, 수정해주시길 바라요!). + +Nushell은 [Rust](https://www.rust-lang.org) 프로그래밍 언어로 작성되어 있습니다. +그러나 굳이 Rust를 할 줄 알아야 도움을 주실 수 있는 것은 아닙니다. +웹 개발에 대해 조금 알고 계시다면, 이 웹사이트나 Nana 프로젝트에 도움을 주실 수 있습니다. +또한 [Dataframes](dataframes.md)에서는 당신의 데이터 처리 능력을 활용하실 수 있습니다. + +멋진 스크립트나 플러그인, 또는 통합 확장 등을 작성하셨다면, `nu_scripts` 또는 Awesome Nu에 기여해 주세요. +발견한 버그와 함께 재현 방법을 GitHub issue에 올려 주시는 것도 매우 유용한 도움이 됩니다! +Nushell을 사용하는 것만으로도 도움을 주실 수 있어요! + +Nushell은 빠르게 발전하고 있습니다. 따라서 이 책도 업데이트에 대한 꾸준한 노력이 필요합니다. +이 책에 기여하는 것은 Markdown의 기본적인 사용법 외에 다른 어떤 특별한 능력도 필요하지 않습니다. +나아가, 이 책의 여러 부분들을 당신의 언어로 번역할 수도 있습니다. + +## 커뮤니티 + +Nushell에 관한 사항들은 주로 [디스코드](https://discord.com/invite/NtAbbGn)에서 논의됩니다. +[X](https://twitter.com/nu_shell)계정을 팔로유하여 업데이트나 뉴스를 받을 수도 있습니다. +마지막으로, GitHub discussions나 GitHub issues를 사용하는 방법도 있어요! diff --git a/ko-KR/book/advanced.md b/ko-KR/book/advanced.md new file mode 100644 index 00000000000..c36a91b9fb3 --- /dev/null +++ b/ko-KR/book/advanced.md @@ -0,0 +1,20 @@ +# (살짝) 더 깊게 + +While the "Advanced" title might sound daunting and you might be tempted to skip this chapter, in fact, some of the most interesting and powerful features can be found here. + +Besides the built-in commands, Nushell has a [standard library](standard_library.md). + +Nushell operates on _structured data_. +You could say that Nushell is a "data-first" shell and a programming language. +To further explore the data-centric direction, Nushell includes a full-featured dataframe processing engine using [Polars](https://github.com/pola-rs/polars) as the backend. +Make sure to check the [Dataframes documentation](dataframes.md) if you want to process large data efficiently directly in your shell. + +Values in Nushell contain some extra [metadata](metadata.md). +This metadata can be used, for example, to [create custom errors](creating_errors.md). + +Thanks to Nushell's strict scoping rules, it is very easy to [iterate over collections in parallel](parallelism.md) which can help you speed up long-running scripts by just typing a few characters. + +You can [interactively explore data](explore.md) with the [`explore`](/commands/docs/explore.md) command. + +Finally, you can extend Nushell's functionality with [plugins](plugins.md). +Almost anything can be a plugin as long as it communicates with Nushell in a protocol that Nushell understands. diff --git a/ko-KR/book/aliases.md b/ko-KR/book/aliases.md new file mode 100644 index 00000000000..4dc6b197bfb --- /dev/null +++ b/ko-KR/book/aliases.md @@ -0,0 +1,113 @@ +# Alias + +Aliases in Nushell offer a way of doing a simple replacement of command calls (both external and internal commands). This allows you to create a shorthand name for a longer command, including its default arguments. + +For example, let's create an alias called `ll` which will expand to `ls -l`. + +```nu +> alias ll = ls -l +``` + +We can now call this alias: + +```nu +> ll +``` + +Once we do, it's as if we typed `ls -l`. This also allows us to pass in flags or positional parameters. For example, we can now also write: + +```nu +> ll -a +``` + +And get the equivalent to having typed `ls -l -a`. + +## List all loaded aliases + +Your useable aliases can be seen in `scope aliases` and `help aliases`. + +## Persisting + +To make your aliases persistent they must be added to your _config.nu_ file by running `config nu` to open an editor and inserting them, and then restarting nushell. +e.g. with the above `ll` alias, you can add `alias ll = ls -l` anywhere in _config.nu_ + +```nu +$env.config = { + # main configuration +} + +alias ll = ls -l + +# some other config and script loading +``` + +## Piping in aliases + +Note that `alias uuidgen = uuidgen | tr A-F a-f` (to make uuidgen on mac behave like linux) won't work. +The solution is to define a command without parameters that calls the system program `uuidgen` via `^`. + +```nu +def uuidgen [] { ^uuidgen | tr A-F a-f } +``` + +See more in the [custom commands](custom_commands.md) section of this book. + +Or a more idiomatic example with nushell internal commands + +```nu +def lsg [] { ls | sort-by type name -i | grid -c | str trim } +``` + +displaying all listed files and folders in a grid. + +## Replacing existing commands using aliases + +> Caution! When replacing commands it is best to "back up" the command first and avoid recursion error. + +How to back up a command like `ls`: + +```nu +alias core-ls = ls # This will create a new alias core-ls for ls +``` + +Now you can use `core-ls` as `ls` in your nu-programming. You will see further down how to use `core-ls`. + +The reason you need to use alias is because, unlike `def`, aliases are position-dependent. So, you need to "back up" the old command first with an alias, before re-defining it. +If you do not backup the command and you replace the command using `def` you get a recursion error. + +```nu +def ls [] { ls }; ls # Do *NOT* do this! This will throw a recursion error + +#output: +#Error: nu::shell::recursion_limit_reached +# +# × Recursion limit (50) reached +# ╭─[C:\Users\zolodev\AppData\Roaming\nushell\config.nu:807:1] +# 807 │ +# 808 │ def ls [] { ls }; ls +# · ───┬── +# · ╰── This called itself too many times +# ╰──── +``` + +The recommended way to replace an existing command is to shadow the command. +Here is an example shadowing the `ls` command. + +```nu +# An escape hatch to have access to the original ls command +alias core-ls = ls + +# Call the built-in ls command with a path parameter +def old-ls [path] { + core-ls $path | sort-by type name -i +} + +# Shadow the ls command so that you always have the sort type you want +def ls [path?] { + if $path == null { + old-ls . + } else { + old-ls $path + } +} +``` diff --git a/ko-KR/book/background_task.md b/ko-KR/book/background_task.md new file mode 100644 index 00000000000..a2cc48b0909 --- /dev/null +++ b/ko-KR/book/background_task.md @@ -0,0 +1,34 @@ +# Nu의 백그라운드 작업 + +Currently, Nushell doesn't have built-in background task management feature, but you can make it "support" background task with some tools, here are some examples: + +1. Using a third-party task management tools, like [pueue](https://github.com/Nukesor/pueue) +2. Using a terminal multiplexer, like [tmux](https://github.com/tmux/tmux/wiki) or [zellij](https://zellij.dev/) + +## Using nu with pueue + +The module borrows the power of [pueue](https://github.com/Nukesor/pueue), it is possible to schedule background tasks to pueue, and manage those tasks (such as viewing logs, killing tasks, or getting the running status of all tasks, creating groups, pausing tasks etc etc) + +Unlike terminal multiplexer, you don't need to attach to multiple tmux sessions, and get task status easily. + +Here we provide a [nushell module](https://github.com/nushell/nu_scripts/tree/main/modules/background_task) to work with pueue easiler. + +Here is a setup example to make Nushell "support" background tasks: + +1. Install pueue +2. run `pueued`, you can refer to [start-the-daemon page](https://github.com/Nukesor/pueue/wiki/Get-started#start-the-daemon) for more information. +3. Put the [task.nu](https://github.com/nushell/nu_scripts/blob/main/modules/background_task/task.nu) file under `$env.NU_LIB_DIRS`. +4. Add a line to the `$nu.config-path` file: `use task.nu` +5. Restart Nushell. + +Then you will get some commands to schedule background tasks. (e.g: `task spawn`, `task status`, `task log`) + +Cons: It spawns a new Nushell interpreter to execute every single task, so it doesn't inherit current scope's variables, custom commands, alias definition. +It only inherits environment variables whose value can be converted to a string. +Therefore, if you want to use custom commands or variables, you have to [`use`](/commands/docs/use.md) or [`def`](/commands/docs/def.md) them within the given block. + +## Using nu with terminal multiplexer + +You can choose and install a terminal multiplexer and use it. + +It allows you to easily switch between multiple programs in one terminal, detach them (they continue to run in the background) and reconnect them to a different terminal. As a result, it is very flexible and usable. diff --git a/ko-KR/book/cheat_sheet.md b/ko-KR/book/cheat_sheet.md new file mode 100644 index 00000000000..ca542a2c5a2 --- /dev/null +++ b/ko-KR/book/cheat_sheet.md @@ -0,0 +1,549 @@ +# Nushell 치트시트 + +## Data types + +```nu + > "12" | into int +``` + +> **converts string to integer** + +--- + +```nu + > date now | date to-timezone "Europe/London" +``` + +> **converts present date to provided time zone** + +--- + +```nu + > {'name': 'nu', 'stars': 5, 'language': 'Python'} | upsert language 'Rust' +``` + +> **updates a record's language and if none is specified inserts provided value** + +--- + +```nu + > [one two three] | to yaml +``` + +> **converts list of strings to yaml** + +--- + +```nu + > [[framework, language]; [Django, Python] [Lavarel, PHP]] +``` + +> **prints the table** + +--- + +```nu + > [{name: 'Robert' age: 34 position: 'Designer'} + {name: 'Margaret' age: 30 position: 'Software Developer'} + {name: 'Natalie' age: 50 position: 'Accountant'} + ] | select name position +``` + +> **selects two columns from the table and prints their values** + +## Strings + +```nu + > let name = "Alice" + > $"greetings, ($name)!" +``` + +> **prints `greetings, Alice!`** + +--- + +```nu + > let string_list = "one,two,three" | split row "," + $string_list + + ╭───┬───────╮ + │ 0 │ one │ + │ 1 │ two │ + │ 2 │ three │ + ╰───┴───────╯ +``` + +> **splits the string with specified delimiter and saves the list to `string_list` variable** + +--- + +```nu + "Hello, world!" | str contains "o, w" +``` + +> **checks if a string contains a substring and returns `boolean`** + +--- + +```nu + let str_list = [zero one two] + $str_list | str join ',' +``` + +> **joins the list of strings using provided delimiter** + +--- + +```nu + > 'Hello World!' | str substring 4..8 +``` + +> **created a slice from a given string with start (4) and end (8) indices** + +--- + +```nu + > 'Nushell 0.80' | parse '{shell} {version}' + + ╭───┬─────────┬─────────╮ + │ # │ shell │ version │ + ├───┼─────────┼─────────┤ + │ 0 │ Nushell │ 0.80 │ + ╰───┴─────────┴─────────╯ +``` + +> **parses the string to columns** + +```nu + > "acronym,long\nAPL,A Programming Language" | from csv +``` + +> **parses comma separated values (csv)** + +```nu + > $'(ansi purple_bold)This text is a bold purple!(ansi reset)' +``` + +> **ansi command colors the text (alsways end with `ansi reset` to reset color to default)** + +## Lists + +```nu + > [foo bar baz] | insert 1 'beeze' + + ╭───┬───────╮ + │ 0 │ foo │ + │ 1 │ beeze │ + │ 2 │ bar │ + │ 3 │ baz │ + ╰───┴───────╯ +``` + +> **inserts `beeze` value at the 2nd index of the list** + +--- + +```nu + > [1, 2, 3, 4] | update 1 10 +``` + +> **updates 2nd value to 10** + +--- + +```nu + > let numbers = [1, 2, 3, 4, 5] + > $numbers | prepend 0 +``` + +> **adds value at the beginning of the list** + +--- + +```nu + > let numbers = [1, 2, 3, 4, 5] + > $numbers | append 6 +``` + +> **adds value at the end of the list** + +--- + +```nu + > let flowers = [cammomile marigold rose forget-me-not] + > let flowers = ($flowers | first 2) + > $flowers +``` + +> **creates slice of first two values from `flowers` list** + +--- + +```nu + > let planets = [Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune] + > $planets | each { |it| $"($it) is a planet of the solar system" } +``` + +> **iterates over a list; `it` is current list value** + +--- + +```nu + > $planets | enumerate | each { |it| $"($it.index + 1) - ($it.item)" } +``` + +> **iterates over a list and provides index and value in `it`** + +--- + +```nu + > let scores = [3 8 4] + > $"total = ($scores | reduce { |it, acc| $acc + $it })" +``` + +> **reduces the list to a single value, `reduce` gives access to accumulator that is applied +> to each element in the list** + +--- + +```nu + > $"total = ($scores | reduce --fold 1 { |it, acc| $acc * $it })" +``` + +> **initial value for accumulator value can be set with `--fold`** + +--- + +```nu + > let planets = [Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune] + > $planets.2 + > Earth +``` + +> **gives access to the 3rd item in the list** + +--- + +```nu + > let planets = [Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune] + > $planets | any {|it| $it | str starts-with "E" } + > true +``` + +> **checks if any string in the list starts with `E`** + +--- + +```nu + > let cond = {|x| $x < 0 }; [-1 -2 9 1] | take while $cond + ╭───┬────╮ + │ 0 │ -1 │ + │ 1 │ -2 │ + ╰───┴────╯ +``` + +> **creates slice of items that satisfy provided condition** + +## Tables + +```nu + > ls | sort-by size +``` + +> **sorting table by size of files** + +--- + +```nu + > ls | sort-by size | first 5 +``` + +> **sorting table by size of files and show first 5 entries** + +--- + +```nu + > let $a = [[first_column second_column third_column]; [foo bar snooze]] + > let $b = [[first_column second_column third_column]; [hex seeze feeze]] + > $a | append $b + + ╭───┬──────────────┬───────────────┬──────────────╮ + │ # │ first_column │ second_column │ third_column │ + ├───┼──────────────┼───────────────┼──────────────┤ + │ 0 │ foo │ bar │ snooze │ + │ 1 │ hex │ seeze │ feeze │ + ╰───┴──────────────┴───────────────┴──────────────╯ +``` + +> **concatenate two tables with same columns** + +--- + +```nu + > let teams_scores = [[team score plays]; ['Boston Celtics' 311 3] ['Golden State Warriors', 245 2]] + > $teams_scores | drop column + + ╭───┬───────────────────────┬───────╮ + │ # │ team │ score │ + ├───┼───────────────────────┼───────┤ + │ 0 │ Boston Celtics │ 311 │ + │ 1 │ Golden State Warriors │ 245 │ + ╰───┴───────────────────────┴───────╯ +``` + +> **remove the last column of a table** + +## Files & Filesystem + +```nu + > start file.txt +``` + +> **opens a text file with the default text editor** + +--- + +```nu + > 'lorem ipsum ' | save file.txt +``` + +> **saves a string to text file** + +--- + +```nu + > 'dolor sit amet' | save --append file.txt +``` + +> **appends a string to the end of file.txt** + +--- + +```nu + > { a: 1, b: 2 } | save file.json +``` + +> **saves a record to file.json** + +--- + +```nu + > glob **/*.{rs,toml} --depth 2 +``` + +> **searches for `.rs` and `.toml` files recursively up to 2 folders deep** + +--- + +```nu + > watch . --glob=**/*.rs {|| cargo test } +``` + +> **runs cargo test whenever a Rust file changes** + +--- + +## Custom Commands + +```nu + def greet [name: string] { + $"hello ($name­)" + } +``` + +> **custom command with parameter type set to string** + +--- + +```nu + def greet [name = "nushell"] { + $"hello ($name­)" + } +``` + +> **custom command with default parameter set to nushell** + +--- + +```nu + def greet [ + name: string + --age: int + ] { + [$name $age] + } + + > greet world --age 10 +``` + +> **passing named parameter by defining flag for custom commands** + +--- + +```nu + def greet [ + name: string + --age (-a): int + --twice + ] { + if $twice { + [$name $age $name $age] + } else { + [$name $age] + } + } + > greet -a 10 --twice hello +``` + +> **using flag as a switch with a shorthand flag (-a) for the age** + +--- + +```nu + def greet [...name: string] { + print "­hello all:" + for $n in $name { + print $n + } + } + + > greet earth mars jupiter venus +``` + +> **custom command which takes any number of positional arguments using rest params** + +## Variables & Subexpressions + +```nu + > let val = 42 + > print $val + 42 +``` + +> **an immutable variable cannot change its value after declaration** + +--- + +```nu + > let val = 42 + > do { let val = 101; $val } + 101 + > $val + 42 +``` + +> **shadowing variable (declaring variable with the same name in a different scope)** + +--- + +```nu + > mut val = 42 + > $val += 27 + > $val + 69 +``` + +> **declaring a mutable variable with mut key word** + +--- + +```nu + > mut x = 0 + > [1 2 3] | each { $x += 1 } +``` + +> **closures and nested defs cannot capture mutable variables from their enviro­nment. +> This expression results in error.** + +```nu + > const plugin = 'path/­to/­plugin' + > register $plugin +``` + +> **a constant variable is immutable value which is fully evaluated at parse-time** + +--- + +```nu + > let files = (ls) + > $files.na­me?.0? +``` + +> **using question mark operator to return null instead of error if provided path is incorrect** + +--- + +```nu + > let big_files = (ls | where size > 10kb) + > $big_files +``` + +> **using subexp­ression by wrapping the expression with parent­heses ()** + +--- + +## Modules + +```nu + > module greetings { + export def hello [name: string] { + $"hello ($name­)!" + } + + export def hi [where: string] { + $"hi ($where)!­" + } + } + + > use greetings hello + > hello "­wor­ld" +``` + +> **using inline module** + +--- + +```nu + # greeti­ngs.nu + export-env { + $env.M­YNAME = "­Arthur, King of the Briton­s" + } + export def hello [] { + $"hello ($env.M­YN­AME­)" + } + + > use greeti­ngs.nu + > $env.M­YNAME + Arthur, King of the Britons + > greetings hello + hello Arthur, King of the Britons! +``` + +> **importing module from file and using its enviro­nment in current scope** + +--- + +```nu + # greeti­ngs.nu + export def hello [name: string] { + $"hello ($name­)!" + } + + export def hi [where: string] { + $"hi ($where)!­" + } + + export def main [] { + "­gre­etings and salutations!" + } + + > use greeti­ngs.nu + > greetings + greetings and saluta­tions! + > greetings hello world + hello world! +``` + +> **using main command in module** + +--- diff --git a/ko-KR/book/coloring_and_theming.md b/ko-KR/book/coloring_and_theming.md new file mode 100644 index 00000000000..b0dd184890b --- /dev/null +++ b/ko-KR/book/coloring_and_theming.md @@ -0,0 +1,562 @@ +# Nu에 테마 적용하기 + +Many parts of Nushell's interface can have their color customized. All of these can be set in the `config.nu` configuration file. If you see the hash/hashtag/pound mark `#` in the config file it means the text after it is commented out. + +1. table borders +2. primitive values +3. shapes (this is the command line syntax) +4. prompt +5. LS_COLORS + +## `Table borders` + +Table borders are controlled by the `$env.config.table.mode` setting in `config.nu`. Here is an example: + +```nu +> $env.config = { + table: { + mode: rounded + } +} +``` + +Here are the current options for `$env.config.table.mode`: + +- `rounded` # of course, this is the best one :) +- `basic` +- `compact` +- `compact_double` +- `light` +- `thin` +- `with_love` +- `reinforced` +- `heavy` +- `none` +- `other` + +### `Color symbologies` + +--- + +- `r` - normal color red's abbreviation +- `rb` - normal color red's abbreviation with bold attribute +- `red` - normal color red +- `red_bold` - normal color red with bold attribute +- `"#ff0000"` - "#hex" format foreground color red (quotes are required) +- `{ fg: "#ff0000" bg: "#0000ff" attr: b }` - "full #hex" format foreground red in "#hex" format with a background of blue in "#hex" format with an attribute of bold abbreviated. + +### `attributes` + +--- + +| code | meaning | +| ---- | ------------------- | +| l | blink | +| b | bold | +| d | dimmed | +| h | hidden | +| i | italic | +| r | reverse | +| s | strikethrough | +| u | underline | +| n | nothing | +| | defaults to nothing | + +### `normal colors` and `abbreviations` + +| code | name | +| ------ | ---------------------- | +| g | green | +| gb | green_bold | +| gu | green_underline | +| gi | green_italic | +| gd | green_dimmed | +| gr | green_reverse | +| gbl | green_blink | +| gst | green_strike | +| lg | light_green | +| lgb | light_green_bold | +| lgu | light_green_underline | +| lgi | light_green_italic | +| lgd | light_green_dimmed | +| lgr | light_green_reverse | +| lgbl | light_green_blink | +| lgst | light_green_strike | +| r | red | +| rb | red_bold | +| ru | red_underline | +| ri | red_italic | +| rd | red_dimmed | +| rr | red_reverse | +| rbl | red_blink | +| rst | red_strike | +| lr | light_red | +| lrb | light_red_bold | +| lru | light_red_underline | +| lri | light_red_italic | +| lrd | light_red_dimmed | +| lrr | light_red_reverse | +| lrbl | light_red_blink | +| lrst | light_red_strike | +| u | blue | +| ub | blue_bold | +| uu | blue_underline | +| ui | blue_italic | +| ud | blue_dimmed | +| ur | blue_reverse | +| ubl | blue_blink | +| ust | blue_strike | +| lu | light_blue | +| lub | light_blue_bold | +| luu | light_blue_underline | +| lui | light_blue_italic | +| lud | light_blue_dimmed | +| lur | light_blue_reverse | +| lubl | light_blue_blink | +| lust | light_blue_strike | +| b | black | +| bb | black_bold | +| bu | black_underline | +| bi | black_italic | +| bd | black_dimmed | +| br | black_reverse | +| bbl | black_blink | +| bst | black_strike | +| ligr | light_gray | +| ligrb | light_gray_bold | +| ligru | light_gray_underline | +| ligri | light_gray_italic | +| ligrd | light_gray_dimmed | +| ligrr | light_gray_reverse | +| ligrbl | light_gray_blink | +| ligrst | light_gray_strike | +| y | yellow | +| yb | yellow_bold | +| yu | yellow_underline | +| yi | yellow_italic | +| yd | yellow_dimmed | +| yr | yellow_reverse | +| ybl | yellow_blink | +| yst | yellow_strike | +| ly | light_yellow | +| lyb | light_yellow_bold | +| lyu | light_yellow_underline | +| lyi | light_yellow_italic | +| lyd | light_yellow_dimmed | +| lyr | light_yellow_reverse | +| lybl | light_yellow_blink | +| lyst | light_yellow_strike | +| p | purple | +| pb | purple_bold | +| pu | purple_underline | +| pi | purple_italic | +| pd | purple_dimmed | +| pr | purple_reverse | +| pbl | purple_blink | +| pst | purple_strike | +| lp | light_purple | +| lpb | light_purple_bold | +| lpu | light_purple_underline | +| lpi | light_purple_italic | +| lpd | light_purple_dimmed | +| lpr | light_purple_reverse | +| lpbl | light_purple_blink | +| lpst | light_purple_strike | +| c | cyan | +| cb | cyan_bold | +| cu | cyan_underline | +| ci | cyan_italic | +| cd | cyan_dimmed | +| cr | cyan_reverse | +| cbl | cyan_blink | +| cst | cyan_strike | +| lc | light_cyan | +| lcb | light_cyan_bold | +| lcu | light_cyan_underline | +| lci | light_cyan_italic | +| lcd | light_cyan_dimmed | +| lcr | light_cyan_reverse | +| lcbl | light_cyan_blink | +| lcst | light_cyan_strike | +| w | white | +| wb | white_bold | +| wu | white_underline | +| wi | white_italic | +| wd | white_dimmed | +| wr | white_reverse | +| wbl | white_blink | +| wst | white_strike | +| dgr | dark_gray | +| dgrb | dark_gray_bold | +| dgru | dark_gray_underline | +| dgri | dark_gray_italic | +| dgrd | dark_gray_dimmed | +| dgrr | dark_gray_reverse | +| dgrbl | dark_gray_blink | +| dgrst | dark_gray_strike | + +### `"#hex"` format + +--- + +The "#hex" format is one way you typically see colors represented. It's simply the `#` character followed by 6 characters. The first two are for `red`, the second two are for `green`, and the third two are for `blue`. It's important that this string be surrounded in quotes, otherwise Nushell thinks it's a commented out string. + +Example: The primary `red` color is `"#ff0000"` or `"#FF0000"`. Upper and lower case in letters shouldn't make a difference. + +This `"#hex"` format allows us to specify 24-bit truecolor tones to different parts of Nushell. + +## `full "#hex"` format + +--- + +The `full "#hex"` format is a take on the `"#hex"` format but allows one to specify the foreground, background, and attributes in one line. + +Example: `{ fg: "#ff0000" bg: "#0000ff" attr: b }` + +- foreground of red in "#hex" format +- background of blue in "#hex" format +- attribute of bold abbreviated + +## `Primitive values` + +--- + +Primitive values are things like `int` and `string`. Primitive values and shapes can be set with a variety of color symbologies seen above. + +This is the current list of primitives. Not all of these are configurable. The configurable ones are marked with \*. + +| primitive | default color | configurable | +| ------------ | --------------------- | ------------ | +| `any` | | | +| `binary` | Color::White.normal() | \* | +| `block` | Color::White.normal() | \* | +| `bool` | Color::White.normal() | \* | +| `cellpath` | Color::White.normal() | \* | +| `condition` | | | +| `custom` | | | +| `date` | Color::White.normal() | \* | +| `duration` | Color::White.normal() | \* | +| `expression` | | | +| `filesize` | Color::White.normal() | \* | +| `float` | Color::White.normal() | \* | +| `glob` | | | +| `import` | | | +| `int` | Color::White.normal() | \* | +| `list` | Color::White.normal() | \* | +| `nothing` | Color::White.normal() | \* | +| `number` | | | +| `operator` | | | +| `path` | | | +| `range` | Color::White.normal() | \* | +| `record` | Color::White.normal() | \* | +| `signature` | | | +| `string` | Color::White.normal() | \* | +| `table` | | | +| `var` | | | +| `vardecl` | | | +| `variable` | | | + +#### special "primitives" (not really primitives but they exist solely for coloring) + +| primitive | default color | configurable | +| --------------------------- | -------------------------- | ------------ | +| `leading_trailing_space_bg` | Color::Rgb(128, 128, 128)) | \* | +| `header` | Color::Green.bold() | \* | +| `empty` | Color::Blue.normal() | \* | +| `row_index` | Color::Green.bold() | \* | +| `hints` | Color::DarkGray.normal() | \* | + +Here's a small example of changing some of these values. + +```nu +> let config = { + color_config: { + separator: purple + leading_trailing_space_bg: "#ffffff" + header: gb + date: wd + filesize: c + row_index: cb + bool: red + int: green + duration: blue_bold + range: purple + float: red + string: white + nothing: red + binary: red + cellpath: cyan + hints: dark_gray + } +} +``` + +Here's another small example using multiple color syntaxes with some comments. + +```nu +> let config = { + color_config: { + separator: "#88b719" # this sets only the foreground color like PR #486 + leading_trailing_space_bg: white # this sets only the foreground color in the original style + header: { # this is like PR #489 + fg: "#B01455", # note, quotes are required on the values with hex colors + bg: "#ffb900", # note, commas are not required, it could also be all on one line + attr: bli # note, there are no quotes around this value. it works with or without quotes + } + date: "#75507B" + filesize: "#729fcf" + row_index: { + # note, that this is another way to set only the foreground, no need to specify bg and attr + fg: "#e50914" + } + } +} +``` + +## `Shape` values + +As mentioned above, `shape` is a term used to indicate the syntax coloring. + +Here's the current list of flat shapes. + +| shape | default style | configurable | +| ---------------------------- | -------------------------------------- | ------------ | +| `shape_block` | fg(Color::Blue).bold() | \* | +| `shape_bool` | fg(Color::LightCyan) | \* | +| `shape_custom` | bold() | \* | +| `shape_external` | fg(Color::Cyan) | \* | +| `shape_externalarg` | fg(Color::Green).bold() | \* | +| `shape_filepath` | fg(Color::Cyan) | \* | +| `shape_flag` | fg(Color::Blue).bold() | \* | +| `shape_float` | fg(Color::Purple).bold() | \* | +| `shape_garbage` | fg(Color::White).on(Color::Red).bold() | \* | +| `shape_globpattern` | fg(Color::Cyan).bold() | \* | +| `shape_int` | fg(Color::Purple).bold() | \* | +| `shape_internalcall` | fg(Color::Cyan).bold() | \* | +| `shape_list` | fg(Color::Cyan).bold() | \* | +| `shape_literal` | fg(Color::Blue) | \* | +| `shape_nothing` | fg(Color::LightCyan) | \* | +| `shape_operator` | fg(Color::Yellow) | \* | +| `shape_range` | fg(Color::Yellow).bold() | \* | +| `shape_record` | fg(Color::Cyan).bold() | \* | +| `shape_signature` | fg(Color::Green).bold() | \* | +| `shape_string` | fg(Color::Green) | \* | +| `shape_string_interpolation` | fg(Color::Cyan).bold() | \* | +| `shape_table` | fg(Color::Blue).bold() | \* | +| `shape_variable` | fg(Color::Purple) | \* | + +Here's a small example of how to apply color to these items. Anything not specified will receive the default color. + +```nu +> $env.config = { + color_config: { + shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b} + shape_bool: green + shape_int: { fg: "#0000ff" attr: b} + } +} +``` + +## `Prompt` configuration and coloring + +The Nushell prompt is configurable through these environment variables and config items: + +- `PROMPT_COMMAND`: Code to execute for setting up the prompt (block) +- `PROMPT_COMMAND_RIGHT`: Code to execute for setting up the _RIGHT_ prompt (block) (see oh-my.nu in nu_scripts) +- `PROMPT_INDICATOR` = "〉": The indicator printed after the prompt (by default ">"-like Unicode symbol) +- `PROMPT_INDICATOR_VI_INSERT` = ": " +- `PROMPT_INDICATOR_VI_NORMAL` = "v " +- `PROMPT_MULTILINE_INDICATOR` = "::: " +- `render_right_prompt_on_last_line`: Bool value to enable or disable the right prompt to be rendered on the last line of the prompt + +Example: For a simple prompt one could do this. Note that `PROMPT_COMMAND` requires a `block` whereas the others require a `string`. + +```nu +> $env.PROMPT_COMMAND = { build-string (date now | format date '%m/%d/%Y %I:%M:%S%.3f') ': ' (pwd | path basename) } +``` + +If you don't like the default `PROMPT_INDICATOR` you could change it like this. + +```nu +> $env.PROMPT_INDICATOR = "> " +``` + +If you're using `starship`, you'll most likely want to show the right prompt on the last line of the prompt, just like zsh or fish. You could modify the `config.nu` file, just set `render_right_prompt_on_last_line` to true: + +```nu +config { + render_right_prompt_on_last_line = true + ... +} +``` + +Coloring of the prompt is controlled by the `block` in `PROMPT_COMMAND` where you can write your own custom prompt. We've written a slightly fancy one that has git statuses located in the [nu_scripts repo](https://github.com/nushell/nu_scripts/blob/main/modules/prompt/oh-my.nu). + +### Transient prompt + +If you want a different prompt displayed for previously entered commands, you can use Nushell's transient prompt feature. This can be useful if your prompt has lots of information that is unnecessary to show for previous lines (e.g. time and Git status), since you can make it so that previous lines show with a shorter prompt. + +Each of the `PROMPT_*` variables has a corresponding `TRANSIENT_PROMPT_*` variable to be used for changing that segment when displaying past prompts: `TRANSIENT_PROMPT_COMMAND`, `TRANSIENT_PROMPT_COMMAND_RIGHT`, `TRANSIENT_PROMPT_INDICATOR`, `TRANSIENT_PROMPT_INDICATOR_VI_INSERT`, `TRANSIENT_PROMPT_INDICATOR_VI_NORMAL`, `TRANSIENT_PROMPT_MULTILINE_INDICATOR`. By default, the `PROMPT_*` variables are used for displaying past prompts. + +For example, if you want to make past prompts show up without a left prompt entirely and leave only the indicator, you can use: + +```nu +> $env.TRANSIENT_PROMPT_COMMAND = "" +``` + +If you want to go back to the normal left prompt, you'll have to unset `TRANSIENT_PROMPT_COMMAND`: + +```nu +> hide-env TRANSIENT_PROMPT_COMMAND +``` + +## `LS_COLORS` colors for the [`ls`](/commands/docs/ls.md) command + +Nushell will respect and use the `LS_COLORS` environment variable setting on Mac, Linux, and Windows. This setting allows you to define the color of file types when you do a [`ls`](/commands/docs/ls.md). For instance, you can make directories one color, _.md markdown files another color, _.toml files yet another color, etc. There are a variety of ways to color your file types. + +There's an exhaustive list [here](https://github.com/trapd00r/LS_COLORS), which is overkill, but gives you an rudimentary understanding of how to create a ls_colors file that `dircolors` can turn into a `LS_COLORS` environment variable. + +[This](https://www.linuxhowto.net/how-to-set-colors-for-ls-command/) is a pretty good introduction to `LS_COLORS`. I'm sure you can find many more tutorials on the web. + +I like the `vivid` application and currently have it configured in my `config.nu` like this. You can find `vivid` [here](https://github.com/sharkdp/vivid). + +`$env.LS_COLORS = (vivid generate molokai | str trim)` + +If `LS_COLORS` is not set, nushell will default to a built-in `LS_COLORS` setting, based on 8-bit (extended) ANSI colors. + +## Theming + +Theming combines all the coloring above. Here's a quick example of one we put together quickly to demonstrate the ability to theme. This is a spin on the `base16` themes that we see so widespread on the web. + +The key to making theming work is to make sure you specify all themes and colors you're going to use in the `config.nu` file _before_ you declare the `let config = ` line. + +```nu +# let's define some colors + +let base00 = "#181818" # Default Background +let base01 = "#282828" # Lighter Background (Used for status bars, line number and folding marks) +let base02 = "#383838" # Selection Background +let base03 = "#585858" # Comments, Invisibles, Line Highlighting +let base04 = "#b8b8b8" # Dark Foreground (Used for status bars) +let base05 = "#d8d8d8" # Default Foreground, Caret, Delimiters, Operators +let base06 = "#e8e8e8" # Light Foreground (Not often used) +let base07 = "#f8f8f8" # Light Background (Not often used) +let base08 = "#ab4642" # Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted +let base09 = "#dc9656" # Integers, Boolean, Constants, XML Attributes, Markup Link Url +let base0a = "#f7ca88" # Classes, Markup Bold, Search Text Background +let base0b = "#a1b56c" # Strings, Inherited Class, Markup Code, Diff Inserted +let base0c = "#86c1b9" # Support, Regular Expressions, Escape Characters, Markup Quotes +let base0d = "#7cafc2" # Functions, Methods, Attribute IDs, Headings +let base0e = "#ba8baf" # Keywords, Storage, Selector, Markup Italic, Diff Changed +let base0f = "#a16946" # Deprecated, Opening/Closing Embedded Language Tags, e.g. + +# we're creating a theme here that uses the colors we defined above. + +let base16_theme = { + separator: $base03 + leading_trailing_space_bg: $base04 + header: $base0b + date: $base0e + filesize: $base0d + row_index: $base0c + bool: $base08 + int: $base0b + duration: $base08 + range: $base08 + float: $base08 + string: $base04 + nothing: $base08 + binary: $base08 + cellpath: $base08 + hints: dark_gray + + # shape_garbage: { fg: $base07 bg: $base08 attr: b} # base16 white on red + # but i like the regular white on red for parse errors + shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b} + shape_bool: $base0d + shape_int: { fg: $base0e attr: b} + shape_float: { fg: $base0e attr: b} + shape_range: { fg: $base0a attr: b} + shape_internalcall: { fg: $base0c attr: b} + shape_external: $base0c + shape_externalarg: { fg: $base0b attr: b} + shape_literal: $base0d + shape_operator: $base0a + shape_signature: { fg: $base0b attr: b} + shape_string: $base0b + shape_filepath: $base0d + shape_globpattern: { fg: $base0d attr: b} + shape_variable: $base0e + shape_flag: { fg: $base0d attr: b} + shape_custom: {attr: b} +} + +# now let's apply our regular config settings but also apply the "color_config:" theme that we specified above. + +let config = { + filesize_metric: true + table_mode: rounded # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other + use_ls_colors: true + color_config: $base16_theme # <-- this is the theme + use_grid_icons: true + footer_mode: always #always, never, number_of_rows, auto + animate_prompt: false + float_precision: 2 + use_ansi_coloring: true + filesize_format: "b" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, auto + edit_mode: emacs # vi + max_history_size: 10000 + log_level: error +} +``` + +if you want to go full-tilt on theming, you'll want to theme all the items I mentioned at the very beginning, including LS_COLORS, and the prompt. Good luck! + +### Working on light background terminal + +Nushell's default config file contains a light theme definition, if you are working on a light background terminal, you can apply the light theme easily. + +```nu +# in $nu.config-path +$env.config = { + ... + color_config: $dark_theme # if you want a light theme, replace `$dark_theme` to `$light_theme` + ... +} +``` + +You can just change it to light theme by replacing `$dark_theme` to `$light_theme` + +```nu +# in $nu.config-path +$env.config = { + ... + color_config: $light_theme # if you want a light theme, replace `$dark_theme` to `$light_theme` + ... +} +``` + +## Accessibility + +It's often desired to have the minimum amount of decorations when using a screen reader. In those cases, it's possible to disable borders and other decorations for both table and errors with the following options: + +```nu +# in $nu.config-path +$env.config = { + ... + table: { + ... + mode: "none" + ... + } + error_style: "plain" + ... +} + +``` + +## Line editor menus (completion, history, help…) + +Reedline (Nu’s line editor) style is not using the `color_config` key. +Instead, each menu has its own style to be configured separately. +See the [section dedicated to Reedline’s menus configuration](line_editor.md#menus) to learn more on this. diff --git a/ko-KR/book/coming_from_bash.md b/ko-KR/book/coming_from_bash.md new file mode 100644 index 00000000000..848c64bad4e --- /dev/null +++ b/ko-KR/book/coming_from_bash.md @@ -0,0 +1,68 @@ +# Bash에서 전환하기 + +If you're coming from `Git Bash` on Windows, then the external commands you're used to (bash, grep, etc) will not be available in `nu` by default (unless you had explicitly made them available in the Windows Path environment variable). +To make these commands available in `nu` as well, add the following line to your `config.nu` with either `append` or `prepend`. + +``` +$env.Path = ($env.Path | prepend 'C:\Program Files\Git\usr\bin') +``` + +Note: this table assumes Nu 0.60.0 or later. + +| Bash | Nu | Task | +| ------------------------------------ | ------------------------------------------------------------- | ----------------------------------------------------------------- | +| `ls` | `ls` | Lists the files in the current directory | +| `ls ` | `ls ` | Lists the files in the given directory | +| `ls pattern*` | `ls pattern*` | Lists files that match a given pattern | +| `ls -la` | `ls --long --all` or `ls -la` | List files with all available information, including hidden files | +| `ls -d */` | `ls \| where type == dir` | List directories | +| `find . -name *.rs` | `ls **/*.rs` | Find recursively all files that match a given pattern | +| `find . -name Makefile \| xargs vim` | `ls **/Makefile \| get name \| vim $in` | Pass values as command parameters | +| `cd ` | `cd ` | Change to the given directory | +| `cd` | `cd` | Change to the home directory | +| `cd -` | `cd -` | Change to the previous directory | +| `mkdir ` | `mkdir ` | Creates the given path | +| `mkdir -p ` | `mkdir ` | Creates the given path, creating parents as necessary | +| `touch test.txt` | `touch test.txt` | Create a file | +| `> ` | `\| save --raw ` | Save string into a file | +| `>> ` | `\| save --raw --append ` | Append string to a file | +| `> /dev/null` | `\| ignore` | Discard command output | +| `> /dev/null 2>&1` | `out+err> /dev/null` | Discard command output, including stderr | +| `command arg1 arg2 2>&1 \| less` | `run-external --redirect-combine command [arg1 arg2] \| less` | Pipe stdout+stderr of a command into less, output updated live | +| `cat ` | `open --raw ` | Display the contents of the given file | +| | `open ` | Read a file as structured data | +| `mv ` | `mv ` | Move file to new location | +| `cp ` | `cp ` | Copy file to new location | +| `cp -r ` | `cp -r ` | Copy directory to a new location, recursively | +| `rm ` | `rm ` | Remove the given file | +| | `rm -t ` | Move the given file to the system trash | +| `rm -rf ` | `rm -r ` | Recursively removes the given path | +| `date -d ` | `"" \| into datetime -f ` | Parse a date ([format documentation](https://docs.rs/chrono/0.4.15/chrono/format/strftime/index.html)) | +| `sed` | `str replace` | Find and replace a pattern in a string | +| `grep ` | `where $it =~ ` or `find ` | Filter strings that contain the substring | +| `man ` | `help ` | Get the help for a given command | +| | `help commands` | List all available commands | +| | `help --find ` | Search for match in all available commands | +| `command1 && command2` | `command1; command2` | Run a command, and if it's successful run a second | +| `stat $(which git)` | `stat (which git).path` | Use command output as argument for other command | +| `echo /tmp/$RANDOM` | `$"/tmp/(random integer)"` | Use command output in a string | +| `cargo b --jobs=$(nproc)` | `cargo b $"--jobs=(sys \| get cpu \| length)"` | Use command output in an option | +| `echo $PATH` | `$env.PATH` (Non-Windows) or `$env.Path` (Windows) | See the current path | +| `` | `vim $nu.config-path` | Update PATH permanently | +| `export PATH = $PATH:/usr/other/bin` | `$env.PATH = ($env.PATH \| append /usr/other/bin)` | Update PATH temporarily | +| `export` | `$env` | List the current environment variables | +| `` | `vim $nu.config-path` | Update environment variables permanently | +| `FOO=BAR ./bin` | `FOO=BAR ./bin` | Update environment temporarily | +| `export FOO=BAR` | `$env.FOO = BAR` | Set environment variable for current session | +| `echo $FOO` | `$env.FOO` | Use environment variables | +| `echo ${FOO:-fallback}` | `$env.FOO? \| default "ABC"` | Use a fallback in place of an unset variable | +| `unset FOO` | `hide-env FOO` | Unset environment variable for current session | +| `alias s="git status -sb"` | `alias s = git status -sb` | Define an alias temporarily | +| `type FOO` | `which FOO` | Display information about a command (builtin, alias, or executable) | +| `` | `vim $nu.config-path` | Add and edit alias permanently (for new shells) | +| `bash -c ` | `nu -c ` | Run a pipeline of commands | +| `bash