Skip to content

Set GitHubGistFile

Howard Wolosky edited this page Oct 5, 2020 · 1 revision

Set-GitHubGistFile

SYNOPSIS

Updates content of file(s) in an existing gist on GitHub, or adds them if they aren't already part of the gist.

SYNTAX

Content (Default)

Set-GitHubGistFile [-Gist] <String> [-FileName] <String> [-Content] <String> [-PassThru]
 [-AccessToken <String>] [-WhatIf] [-Confirm] [<CommonParameters>]

FileRef

Set-GitHubGistFile [-Gist] <String> [-File] <String[]> [-PassThru] [-AccessToken <String>] [-WhatIf] [-Confirm]
 [<CommonParameters>]

DESCRIPTION

Updates content of file(s) in an existing gist on GitHub, or adds them if they aren't already part of the gist.

This is a helper function built on top of Set-GitHubGist.

The Git repo for this module can be found here: http://aka.ms/PowerShellForGitHub

EXAMPLES

EXAMPLE 1

Set-GitHubGistFile -Gist 1234567 -Content 'Body of my file.' -FileName 'sample.txt'

Adds a file named 'sample.txt' that has the body of "Body of my file." to the existing specified gist, or updates the contents of 'sample.txt' in the gist if is already there.

EXAMPLE 2

Set-GitHubGistFile -Gist 1234567 -File 'c:\files\foo.txt'

Adds the file 'foo.txt' to the existing specified gist, or updates its content if it is already there.

EXAMPLE 3

Set-GitHubGistFile -Gist 1234567 -File ('c:\files\foo.txt', 'c:\other\bar.txt', 'c:\octocat.ps1')

Adds all three files to the existing specified gist, or updates the contents of the files in the gist if they are already there.

PARAMETERS

-AccessToken

If provided, this will be used as the AccessToken for authentication with the REST Api. Otherwise, will attempt to use the configured value or will run unauthenticated.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Content

The content of a single file that should be part of the gist.

Type: System.String
Parameter Sets: Content
Aliases:

Required: True
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-File

An array of filepaths that should be part of this gist. Use this when you have multiple files that should be part of a gist, or when you simply want to reference an existing file on disk.

Type: System.String[]
Parameter Sets: FileRef
Aliases:

Required: True
Position: 3
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-FileName

The name of the file that Content should be stored in within the newly created gist.

Type: System.String
Parameter Sets: Content
Aliases:

Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Gist

The ID for the gist to update.

Type: System.String
Parameter Sets: (All)
Aliases: GistId

Required: True
Position: 2
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-PassThru

Returns the updated gist. By default, this cmdlet does not generate any output. You can use "Set-GitHubConfiguration -DefaultPassThru" to control the default behavior of this switch.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

GitHub.Gist

GitHub.GistComment

GitHub.GistCommit

GitHub.GistFork

GitHub.GistSummary

OUTPUTS

GitHub.Gist

NOTES

RELATED LINKS

PowerShellForGitHub

Docs

PowerShellForGitHub

Functions

Clone this wiki locally