mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 06:37:46 +00:00
rename date format
to format date
(#571)
This commit is contained in:
parent
1d8457fa9d
commit
be47e43db6
17 changed files with 37 additions and 37 deletions
|
@ -334,7 +334,7 @@ export def container-create [
|
|||
$debug $appimage $netadmin $clip
|
||||
$mnt $vols $workdir $cache
|
||||
] | flatten)
|
||||
let name = $"($img | split row '/' | last | str replace ':' '-')_(date now | date format %m%d%H%M)"
|
||||
let name = $"($img | split row '/' | last | str replace ':' '-')_(date now | format date %m%d%H%M)"
|
||||
if $dry_run {
|
||||
echo $"docker ($ns | str join ' ') run --name ($name) ($args|str join ' ') ($img) ($cmd | flatten)"
|
||||
} else {
|
||||
|
|
|
@ -6,7 +6,7 @@ def logtime [msg act] {
|
|||
| into string
|
||||
| str replace ' ' '')
|
||||
|
||||
echo $'($start | date format '%Y-%m-%d_%H:%M:%S%z')(char tab)($period)(char tab)($msg)(char newline)'
|
||||
echo $'($start | format date '%Y-%m-%d_%H:%M:%S%z')(char tab)($period)(char tab)($msg)(char newline)'
|
||||
| save -a ~/.cache/nushell/time.log
|
||||
|
||||
return $result
|
||||
|
|
|
@ -217,7 +217,7 @@ export def get_right_prompt [os use_nerd_fonts] {
|
|||
})
|
||||
(ansi { fg: $TERM_FG bg: $TIME_BG})
|
||||
(char space)
|
||||
(date now | date format '%m/%d/%Y %I:%M:%S%.3f')
|
||||
(date now | format date '%m/%d/%Y %I:%M:%S%.3f')
|
||||
(char space)
|
||||
($R)
|
||||
] | str join)
|
||||
|
@ -231,7 +231,7 @@ export def get_right_prompt [os use_nerd_fonts] {
|
|||
})
|
||||
(ansi { fg: $TERM_FG bg: $TIME_BG})
|
||||
(char space)
|
||||
(date now | date format '%I:%M:%S %p')
|
||||
(date now | format date '%I:%M:%S %p')
|
||||
(char space)
|
||||
($R)
|
||||
] | str join)
|
||||
|
|
|
@ -351,7 +351,7 @@ def get_time_segment [os color_mode] {
|
|||
($time_color)
|
||||
($time_bg_color)
|
||||
(char space)
|
||||
(date now | date format '%I:%M:%S %p')
|
||||
(date now | format date '%I:%M:%S %p')
|
||||
(char space)
|
||||
($R)
|
||||
] | str join)
|
||||
|
|
|
@ -84,7 +84,7 @@ def time_segment [] {
|
|||
} else {
|
||||
$'($theme.fst)%y-%m-%d[%w]%H:%M:%S'
|
||||
}
|
||||
[$bg $"(date now | date format $format)"]
|
||||
[$bg $"(date now | format date $format)"]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ def logtime [msg act] {
|
|||
let result = (do $act)
|
||||
let period = ($"((date now) - $start | into duration -c ns)" | str replace ' ' '')
|
||||
|
||||
echo $'($start | date format '%Y-%m-%d_%H:%M:%S%z')(char tab)($period)(char tab)($msg)(char newline)'
|
||||
echo $'($start | format date '%Y-%m-%d_%H:%M:%S%z')(char tab)($period)(char tab)($msg)(char newline)'
|
||||
| save -a ~/.cache/nushell/power_time.log
|
||||
|
||||
$result
|
||||
|
|
|
@ -11,7 +11,7 @@ def workspaces [] {
|
|||
|
||||
def create_right_prompt [] {
|
||||
let time_segment = ([
|
||||
(date now | date format '%r'),
|
||||
(date now | format date '%r'),
|
||||
" ",
|
||||
(workspaces)
|
||||
] | str join)
|
||||
|
|
|
@ -73,7 +73,7 @@ def get_weather_by_ip [locIdx: int, units: string, token: string] {
|
|||
let forecast = ($forecast_data.list | each {|day|
|
||||
{
|
||||
id: ($day.weather.0.id)
|
||||
dt: ($day.dt | into string | into datetime -z local | date format '%a, %b %e') #'%Y-%m-%d')
|
||||
dt: ($day.dt | into string | into datetime -z local | format date '%a, %b %e') #'%Y-%m-%d')
|
||||
high: ($day.temp.max)
|
||||
low: ($day.temp.min)
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ def get_weather_by_ip [locIdx: int, units: string, token: string] {
|
|||
let forecast = ($forecast_data.list | each {|day|
|
||||
{
|
||||
id: ($day.weather.0.id)
|
||||
dt: ($day.dt | into string | into datetime -z local | date format '%a, %b %e') #'%Y-%m-%d')
|
||||
dt: ($day.dt | into string | into datetime -z local | format date '%a, %b %e') #'%Y-%m-%d')
|
||||
high: ($day.temp.max)
|
||||
low: ($day.temp.min)
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ def timed_weather_run [
|
|||
Source: "expired-cache"
|
||||
Emoji: ($emoji)
|
||||
}
|
||||
$weather_table | upsert last_run_time {(date now | date format '%Y-%m-%d %H:%M:%S %z')} | save $weather_runtime_file
|
||||
$weather_table | upsert last_run_time {(date now | format date '%Y-%m-%d %H:%M:%S %z')} | save $weather_runtime_file
|
||||
}
|
||||
} else {
|
||||
# $"Unable to find [($weather_runtime_file)], creating it(char nl)"
|
||||
|
@ -67,7 +67,7 @@ def timed_weather_run [
|
|||
Source: "initial"
|
||||
Emoji: ($emoji)
|
||||
}
|
||||
$weather_table | upsert last_run_time {(date now | date format '%Y-%m-%d %H:%M:%S %z')} | save $weather_runtime_file
|
||||
$weather_table | upsert last_run_time {(date now | format date '%Y-%m-%d %H:%M:%S %z')} | save $weather_runtime_file
|
||||
}
|
||||
} else {
|
||||
echo "Your command did not run because you are not on Windows..."
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
use get-weather.nu get_weather
|
||||
|
||||
# Create a mutable weather table to hold the weather data
|
||||
$env.WEATHER = (get_weather | upsert last_run_time { (date now | date format '%Y-%m-%d %H:%M:%S %z')})
|
||||
$env.WEATHER = (get_weather | upsert last_run_time { (date now | format date '%Y-%m-%d %H:%M:%S %z')})
|
||||
|
||||
#command to run at interval
|
||||
def-env timed_weather_run [
|
||||
|
@ -30,7 +30,7 @@ def-env timed_weather_run [
|
|||
} else {
|
||||
# $"interval met, running command: [($command)](char nl)"
|
||||
|
||||
$env.WEATHER = (get_weather | upsert last_run_time { (date now | date format '%Y-%m-%d %H:%M:%S %z')})
|
||||
$env.WEATHER = (get_weather | upsert last_run_time { (date now | format date '%Y-%m-%d %H:%M:%S %z')})
|
||||
let temp = ($env.WEATHER.Temperature)
|
||||
let emoji = ($env.WEATHER.Emoji)
|
||||
{
|
||||
|
|
|
@ -132,7 +132,7 @@ export def-env get_weather_by_interval [INTERVAL_WEATHER] {
|
|||
|
||||
if ($LAST_WEATHER_TIME | into datetime) + $INTERVAL_WEATHER < (date now) {
|
||||
let WEATHER = (get_weather_for_prompt (get_location 0))
|
||||
let NEW_WEATHER_TIME = (date now | date format '%Y-%m-%d %H:%M:%S %z')
|
||||
let NEW_WEATHER_TIME = (date now | format date '%Y-%m-%d %H:%M:%S %z')
|
||||
|
||||
$last_runtime_data | upsert weather $WEATHER | upsert last_weather_time $NEW_WEATHER_TIME | save $weather_runtime_file
|
||||
|
||||
|
@ -142,7 +142,7 @@ export def-env get_weather_by_interval [INTERVAL_WEATHER] {
|
|||
}
|
||||
} else {
|
||||
let WEATHER = (get_weather_for_prompt (get_location 0))
|
||||
let LAST_WEATHER_TIME = (date now | date format '%Y-%m-%d %H:%M:%S %z')
|
||||
let LAST_WEATHER_TIME = (date now | format date '%Y-%m-%d %H:%M:%S %z')
|
||||
|
||||
let WEATHER_DATA = {
|
||||
"weather": ($WEATHER)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue