Skip to content

Commit

Permalink
Merge pull request #4 from oliverlabs/post-tags
Browse files Browse the repository at this point in the history
Post tags
  • Loading branch information
oliverlabs authored Feb 9, 2024
2 parents 4f0f6a1 + 33b5933 commit f31b15a
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 0 deletions.
37 changes: 37 additions & 0 deletions content/posts/sudo-for-windows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: 'Sudo for Windows'
date: '2024-02-09T10:59:09Z'
draft: false
tags:
- Windows
- Sudo
- PowerShell
---

Wow. Sudo for Windows is here!

See the official announcement in a Microsoft Devblogs [here](https://devblogs.microsoft.com/commandline/introducing-sudo-for-windows/).

Sudo for Windows is a new way for users to run elevated commands directly from an unelevated console session. It is an ergonomic and familiar solution for users who want to elevate a command without having to first open a new elevated console.

I gave it a try, and it seems to be doing what it says on the tin.

Once enabled in Windows System Settings (_For Developers_ Section) like so:

![Windows System Settings](/img/for-developers-settings2.png)

When elevating a process from the command-line with sudo, a UAC dialog will appear asking the user to confirm the elevation:

![UAC Dialog](/img/uac-dialog.png)

If you are curious how this thing works, here is a diagram from the official announcement:

![Sudo for Windows Diagram](/img/sudo-diagram.png)

And here's how you invoke it:

```powershell
sudo choco upgrade python
```

Overall, I am sure the sudo will save some clicks to the users and make the Windows command-line experience more enjoyable.
42 changes: 42 additions & 0 deletions layouts/partials/partials/post-meta.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{- $scratch := newScratch }}

{{- if not .Date.IsZero -}}
{{- $scratch.Add "meta" (slice (printf "<span title='%s'>%s</span>" (.Date) (.Date | time.Format (default "January 2, 2006" site.Params.DateFormat)))) }}
{{- end }}

{{- if (.Param "ShowReadingTime") -}}
{{- $scratch.Add "meta" (slice (i18n "read_time" .ReadingTime | default (printf "%d min" .ReadingTime))) }}
{{- end }}

{{- if (.Param "ShowWordCount") -}}
{{- $scratch.Add "meta" (slice (i18n "words" .WordCount | default (printf "%d words" .WordCount))) }}
{{- end }}

{{- if (.Param "ShowAuthor") -}}
<span class="meta-item">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke="black" stroke-width="1"
fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<circle cx="12" cy="7" r="4"></circle>
<path d="M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"></path>
</svg>
{{- partial "author.html" . -}}</span>
{{- end }}

{{- if .Params.tags -}}
<span class="meta-item">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-tag meta-icon"
style="user-select: text;">
<path d="M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z" style="user-select: text;">
</path>
<line x1="7" y1="7" x2="7" y2="7" style="user-select: text;"></line>
</svg>
<span class="post-tags">
{{- range ($.GetTerms "tags") -}}
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
{{- end -}}
</span></span>
{{- end }}

{{- delimit . "&nbsp;·&nbsp;" -}}
Binary file added static/img/for-developers-settings1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/sudo-diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/uac-dialog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f31b15a

Please sign in to comment.