什么是在脚本创作和编辑上分享信用的正确方法?

Col*_*337 7 powershell scripting

在我的脚本编写漏洞中,我经常检查脚本是否在我从头开始之前编写过.通常我至少可以通过谷歌或其他方式找到我需要的东西.然后我根据自己的需要调整我的需求并将其投入生产.作为一种最佳实践,我评论我的代码并包含作者信息(我不是抄袭的粉丝).然而,问题是如何以及何时适合添加/更改作者名称.我将从他的博客中使用Ed Wilson的示例脚本作为参考:

Function Get-OutlookCalendar {
    <#
   .Synopsis
    This function returns appointment items from default Outlook profile
   .Description
    This function returns appointment items from default Outlook profile. It
    uses the Outlook interop assembly to use the olFolderCalendar enumeration.
    It creates a custom object consisting of Subject, Start, Duration, Location
    for each appointment item.
   .Example
    Get-OutlookCalendar |
    where-object { $_.start -gt [datetime]"5/10/2011" -AND $_.start -lt `
    [datetime]"5/17/2011" } | sort-object Duration
    Displays subject, start, duration and location for all appointments that
    occur between 5/10/11 and 5/17/11 and sorts by duration of the appointment.
    The sort is shortest appointment on top.
   .Notes
    NAME:  Get-OutlookCalendar
    AUTHOR: ed wilson, msft
    LASTEDIT: 05/10/2011 08:36:42
    KEYWORDS: Microsoft Outlook, Office
    HSG: HSG-05-24-2011
   .Link
     Http://www.ScriptingGuys.com/blog
    #Requires -Version 2.0
    #>

    Add-Type -AssemblyName "Microsoft.Office.Interop.Outlook" | Out-Null
    $olFolders = "Microsoft.Office.Interop.Outlook.OlDefaultFolders" -as [type]
    $outlook = New-Object -ComObject Outlook.Application
    $namespace = $outlook.GetNameSpace("MAPI")
    $folder = $namespace.getDefaultFolder($olFolders::olFolderCalendar)
    $folder.items |
        Select-Object -Property Subject,Start,Duration,Location
}
Run Code Online (Sandbox Code Playgroud)

我将作者字段视为该脚本的联系人,因为它是编写并理解它的人.在列出原始作者不再有意义之前,是否有一个一般的经验法则是关于脚本的更改量?或者他们总是作者,然后你是编辑?

就后者而言,指定它的适当方式是什么?是您在作者标记为"编辑器"下添加一行并更改最后一个编辑标签?记录您的贡献的正确方法究竟如何?有记录的最佳做法吗?

Hop*_*00b 9

我通常把自己作为作者并包括我的(工作)联系信息,看看内部消费的评论如何,对于阅读评论的任何人来说,我都是最有用的联系点.

我通常还会在其中放置一个"改编自"字段或部分,其中列出了我抓取任何代码段的位置和对象.关于剽窃(这些人免费在线提供他们的代码,他们希望人们复制它)以及如果需要能够再次找到资源的更多信息.我的老板们甚至不关心脚本的"信用" - 我可以从头开始写它或复制意大利面,只要它有效......我怀疑IT中的大多数人也是如此.