oh-my-posh的设置json文件
Posted Dr_wei
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oh-my-posh的设置json文件相关的知识,希望对你有一定的参考价值。
"$help": "https://aka.ms/terminal-documentation",
"$schema": "https://aka.ms/terminal-profiles-schema",
"actions":
[
"command":
"action": "scrollUp"
,
"keys": "ctrl+shift+up"
,
"command":
"action": "resizePane",
"direction": "down"
,
"keys": "alt+down"
,
"command":
"action": "splitPane",
"split": "down",
"splitMode": "duplicate"
,
"keys": "alt+shift+d"
,
"command":
"action": "resizePane",
"direction": "left"
,
"keys": "alt+left"
,
"command": "find",
"keys": "ctrl+shift+f"
,
"command": "find",
"keys": "alt+f"
,
"command":
"action": "resizePane",
"direction": "up"
,
"keys": "alt+up"
,
"command": "paste",
"keys": "ctrl+v"
,
"command":
"action": "copy",
"singleLine": false
,
"keys": "ctrl+c"
,
"command": "unbound",
"keys": "ctrl+shift+w"
,
"command": "unbound",
"keys": "alt+f4"
,
"command":
"action": "resizePane",
"direction": "right"
,
"keys": "alt+right"
,
"command":
"action": "splitPane",
"split": "right",
"splitMode": "duplicate"
,
"keys": "alt+d"
,
"command": "closePane",
"keys": "alt+w"
,
"command":
"action": "newTab"
,
"keys": "alt+t"
],
"copyFormatting": "none",
"copyOnSelect": false,
"defaultProfile": "61c54bbd-c2c6-5271-96e7-009a87ff44bf",
"focusFollowMouse": false,
"language": "zh-Hans-CN",
"profiles":
"defaults":
"font":
"face": "Cascadia Mono"
,
"historySize": 9001
,
"list":
[
"bellStyle": "taskbar",
"colorScheme": "Tango Dark",
"commandline": "%SystemRoot%\\\\System32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe -NoExit chcp 65001",
"font":
"face": "DejaVuSansMono Nerd Font",
"weight": "semi-light"
,
"guid": "61c54bbd-c2c6-5271-96e7-009a87ff44bf",
"hidden": false,
"name": "Windows PowerShell",
"startingDirectory": null
,
"backgroundImage": null,
"bellStyle": "taskbar",
"closeOnExit": "graceful",
"colorScheme": "Campbell",
"commandline": "C:\\\\software\\\\git\\\\Git\\\\bin\\\\bash.exe --login",
"cursorColor": "#FFFFFF",
"cursorShape": "bar",
"font":
"face": "DejaVuSansMono Nerd Font Mono",
"size": 12.0
,
"guid": "1d4e097e-fe87-4164-97d7-3ca794c316fd",
"historySize": 9001,
"icon": "C:\\\\software\\\\git\\\\Git\\\\bin\\\\git.png",
"name": "Bash",
"opacity": 100,
"padding": "0, 0, 0, 0",
"tabTitle": null
]
,
"schemes":
[
"background": "#0C0C0C",
"black": "#0C0C0C",
"blue": "#0037DA",
"brightBlack": "#767676",
"brightBlue": "#3B78FF",
"brightCyan": "#61D6D6",
"brightGreen": "#16C60C",
"brightPurple": "#B4009E",
"brightRed": "#E74856",
"brightWhite": "#F2F2F2",
"brightYellow": "#F9F1A5",
"cursorColor": "#FFFFFF",
"cyan": "#3A96DD",
"foreground": "#CCCCCC",
"green": "#13A10E",
"name": "Campbell",
"purple": "#881798",
"red": "#C50F1F",
"selectionBackground": "#FFFFFF",
"white": "#CCCCCC",
"yellow": "#C19C00"
,
"background": "#012456",
"black": "#0C0C0C",
"blue": "#0037DA",
"brightBlack": "#767676",
"brightBlue": "#3B78FF",
"brightCyan": "#61D6D6",
"brightGreen": "#16C60C",
"brightPurple": "#B4009E",
"brightRed": "#E74856",
"brightWhite": "#F2F2F2",
"brightYellow": "#F9F1A5",
"cursorColor": "#FFFFFF",
"cyan": "#3A96DD",
"foreground": "#CCCCCC",
"green": "#13A10E",
"name": "Campbell Powershell",
"purple": "#881798",
"red": "#C50F1F",
"selectionBackground": "#FFFFFF",
"white": "#CCCCCC",
"yellow": "#C19C00"
,
"background": "#282C34",
"black": "#282C34",
"blue": "#61AFEF",
"brightBlack": "#5A6374",
"brightBlue": "#61AFEF",
"brightCyan": "#56B6C2",
"brightGreen": "#98C379",
"brightPurple": "#C678DD",
"brightRed": "#E06C75",
"brightWhite": "#DCDFE4",
"brightYellow": "#E5C07B",
"cursorColor": "#FFFFFF",
"cyan": "#56B6C2",
"foreground": "#DCDFE4",
"green": "#98C379",
"name": "One Half Dark",
"purple": "#C678DD",
"red": "#E06C75",
"selectionBackground": "#FFFFFF",
"white": "#DCDFE4",
"yellow": "#E5C07B"
,
"background": "#FAFAFA",
"black": "#383A42",
"blue": "#0184BC",
"brightBlack": "#4F525D",
"brightBlue": "#61AFEF",
"brightCyan": "#56B5C1",
"brightGreen": "#98C379",
"brightPurple": "#C577DD",
"brightRed": "#DF6C75",
"brightWhite": "#FFFFFF",
"brightYellow": "#E4C07A",
"cursorColor": "#4F525D",
"cyan": "#0997B3",
"foreground": "#383A42",
"green": "#50A14F",
"name": "One Half Light",
"purple": "#A626A4",
"red": "#E45649",
"selectionBackground": "#FFFFFF",
"white": "#FAFAFA",
"yellow": "#C18301"
,
"background": "#002B36",
"black": "#002B36",
"blue": "#268BD2",
"brightBlack": "#073642",
"brightBlue": "#839496",
"brightCyan": "#93A1A1",
"brightGreen": "#586E75",
"brightPurple": "#6C71C4",
"brightRed": "#CB4B16",
"brightWhite": "#FDF6E3",
"brightYellow": "#657B83",
"cursorColor": "#FFFFFF",
"cyan": "#2AA198",
"foreground": "#839496",
"green": "#859900",
"name": "Solarized Dark",
"purple": "#D33682",
"red": "#DC322F",
"selectionBackground": "#FFFFFF",
"white": "#EEE8D5",
"yellow": "#B58900"
,
"background": "#FDF6E3",
"black": "#002B36",
"blue": "#268BD2",
"brightBlack": "#073642",
"brightBlue": "#839496",
"brightCyan": "#93A1A1",
"brightGreen": "#586E75",
"brightPurple": "#6C71C4",
"brightRed": "#CB4B16",
"brightWhite": "#FDF6E3",
"brightYellow": "#657B83",
"cursorColor": "#002B36",
"cyan": "#2AA198",
"foreground": "#657B83",
"green": "#859900",
"name": "Solarized Light",
"purple": "#D33682",
"red": "#DC322F",
"selectionBackground": "#FFFFFF",
"white": "#EEE8D5",
"yellow": "#B58900"
,
"background": "#000000",
"black": "#000000",
"blue": "#3465A4",
"brightBlack": "#555753",
"brightBlue": "#729FCF",
"brightCyan": "#34E2E2",
"brightGreen": "#8AE234",
"brightPurple": "#AD7FA8",
"brightRed": "#EF2929",
"brightWhite": "#EEEEEC",
"brightYellow": "#FCE94F",
"cursorColor": "#FFFFFF",
"cyan": "#06989A",
"foreground": "#D3D7CF",
"green": "#4E9A06",
"name": "Tango Dark",
"purple": "#75507B",
"red": "#CC0000",
"selectionBackground": "#FFFFFF",
"white": "#D3D7CF",
"yellow": "#C4A000"
,
"background": "#FFFFFF",
"black": "#000000",
"blue": "#3465A4",
"brightBlack": "#555753",
"brightBlue": "#729FCF",
"brightCyan": "#34E2E2",
"brightGreen": "#8AE234",
"brightPurple": "#AD7FA8",
"brightRed": "#EF2929",
"brightWhite": "#EEEEEC",
"brightYellow": "#FCE94F",
"cursorColor": "#000000",
"cyan": "#06989A",
"foreground": "#555753",
"green": "#4E9A06",
"name": "Tango Light",
"purple": "#75507B",
"red": "#CC0000",
"selectionBackground": "#FFFFFF",
"white": "#D3D7CF",
"yellow": "#C4A000"
,
"background": "#000000",
"black": "#000000",
"blue": "#000080",
"brightBlack": "#808080",
"brightBlue": "#0000FF",
"brightCyan": "#00FFFF",
"brightGreen": "#00FF00",
"brightPurple": "#FF00FF",
"brightRed": "#FF0000",
"brightWhite": "#FFFFFF",
"brightYellow": "#FFFF00",
"cursorColor": "#FFFFFF",
"cyan": "#008080",
"foreground": "#C0C0C0",
"green": "#008000",
"name": "Vintage",
"purple": "#800080",
"red": "#800000",
"selectionBackground": "#FFFFFF",
"white": "#C0C0C0",
"yellow": "#808000"
],
"snapToGridOnResize": false,
"themes": []
C:\\Users\\你的用户名\\Documents\\WindowsPowerShell\\Microsoft.PowerShell_profile.ps1
set-alias vim "C:\\software\\git\\Git\\usr\\bin\\vim.exe" # 此处为vim的安装路径, 安装完Git就有了
set-alias vi "C:\\software\\git\\Git\\usr\\bin\\vim.exe" # 此处为vim的安装路径, 安装完Git就有了
new-alias grep findstr # Linux grep 使用惯了, 所以建立一个昵称
oh-my-posh --init --shell pwsh --config $env:POSH_THEMES_PATH\\paradox.omp.json |Invoke-Expression
Function Edit-Profile
vim $profile
Function Edit-Vimrc
vim $HOME\\_vimrc
Import-Module posh-git
Import-Module oh-my-posh
#Set-PoshPrompt -Theme iterm2
# 设置向上键为后向搜索历史记录
Set-PSReadlineKeyHandler -Key \'UpArrow\' -Function HistorySearchBackward
# 设置向下键为前向搜索历史纪录
Set-PSReadlineKeyHandler -Key \'DownArrow\' -Function HistorySearchForward
# 每次回溯输入历史,光标定位于输入内容末尾
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
# 设置 Tab 为菜单补全和 Intellisense
Set-PSReadLineKeyHandler -Key "Tab" -Function MenuComplete
# 回到行首/行尾
Set-PSReadlineKeyHandler -Key "Ctrl+a" -Function BeginningOfLine
Set-PSReadlineKeyHandler -Key "Ctrl+e" -Function EndOfLine
# auto suggestions
#Import-Module PSReadLine
#Set-PSReadLineOption -PredictionSource History
#$ThemeSettings.GitSymbols.BranchSymbol = [char]::ConvertFromUtf32(0xE0A0)
# Import the Chocolatey Profile that contains the necessary code to enable
# tab-completions to function for `choco`.
# Be aware that if you are missing these lines from your profile, tab completion
# for `choco` will not function.
# See https://ch0.co/tab-completion for details.
$ChocolateyProfile = "$env:ChocolateyInstall\\helpers\\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile))
Import-Module "$ChocolateyProfile"
Xcode 构建基于 JSON 配置文件的动态设置版本
【中文标题】Xcode 构建基于 JSON 配置文件的动态设置版本【英文标题】:Xcode build dynamically set version based off JSON config file 【发布时间】:2018-01-11 15:55:58 【问题描述】:注意这是一个 React Native 项目。
使用 Android 和 Gradle,我能够解析 JSON 文件并读取值,以便在构建期间将版本动态应用到应用程序。
JSON 文件如下所示:
"name": "AwesomeApp",
"displayName": "Awesome",
"version":
"major": 3,
"minor": 2,
"patch": 1
Gradle 文件最简单的形式是这样的:
def jsonFile = file('../../app.json')
def parsedJson = new groovy.json.JsonSlurper().parseText(jsonFile.text)
def versionMajor = parsedJson.version.major
def versionMinor = parsedJson.version.minor
def versionPatch = parsedJson.version.patch
def appVersionCode = versionMajor * 10000 + versionMinor * 100 + versionPatch
def appVersionName = "$versionMajor.$versionMinor.$versionPatch"
然后在构建中,我可以将其设置为使用动态设置的版本:
android
compileSdkVersion 26
buildToolsVersion '26.0.1'
defaultConfig
applicationId "com.awesome.app"
...
versionCode appVersionCode
versionName appVersionName
...
如何使用 iOS 和 Xcode 实现相同的目标?我知道我们需要修改 CFBundleShortVersionString
和 Build Phases 似乎是动态设置版本的最佳方式,但是这些似乎都是增量/某种 CI 工具的一部分,而不是阅读一个明确设置的 JSON 文件。
任何帮助将不胜感激。
(注:如果我遗漏了任何会导致投反对票的明显内容,请告诉我,我可以相应地修改问题 - 大量点击否定并不能真正帮助提出有效问题的发帖人 -> 抱歉,这是基于我之前问过的一个问题)。
【问题讨论】:
【参考方案1】:最终通过我在 Xcode Build Phases 的 Run Script 中调用的 Node 脚本执行此操作:
构建阶段脚本:
AppVersion=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "$TARGET_BUILD_DIR/$INFOPLIST_PATH")
APP_VERSION="$AppVersion" node $PROJECT_DIR/../iOSVersioning.js
iOSVersioning.js:
const exec = require('child_process');
const APP_VERSION = process.env.APP_VERSION;
const version = require('../app.json').version;
const versionName = `$version.major.$version.minor.$version.patch`;
if (APP_VERSION == versionName)
process.exit();
exec(
`/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $versionName" "$TARGET_BUILD_DIR/$INFOPLIST_PATH"`,
(err, stdout, stderr) =>
if (err)
console.log('Failed to apply the app version.');
process.exit(1);
console.log(`Applied app verion: $versionName`);
);
【讨论】:
以上是关于oh-my-posh的设置json文件的主要内容,如果未能解决你的问题,请参考以下文章